Implementations of polygamma, lgamma, and beta functions for PyTorch

Overview

lgamma

Implementations of polygamma, lgamma, and beta functions for PyTorch. It's very hacky, but that's usually ok for research use.

To build, run:

./make.sh

You'll probably need to pass in the correct CUDA path to build.py, which is run inside make.sh, so modify it to instead call

python build.py --cuda-path YOUR_CUDA_PATH

Also, you'll probably need to change the architecture version/CUDA compute capability inside make.sh, so replace sm_35 with whatever your GPU supports. Feel free to open an issue if you run into another problem!

You might also like...
PyTorch version of Stable Baselines, reliable implementations of reinforcement learning algorithms.
PyTorch version of Stable Baselines, reliable implementations of reinforcement learning algorithms.

PyTorch version of Stable Baselines, reliable implementations of reinforcement learning algorithms.

PyTorch implementations of the paper:
PyTorch implementations of the paper: "Learning Independent Instance Maps for Crowd Localization"

IIM - Crowd Localization This repo is the official implementation of paper: Learning Independent Instance Maps for Crowd Localization. The code is dev

PyTorch implementations of Top-N recommendation, collaborative filtering recommenders.

PyTorch implementations of Top-N recommendation, collaborative filtering recommenders.

PyTorch implementations of algorithms for density estimation

pytorch-flows A PyTorch implementations of Masked Autoregressive Flow and some other invertible transformations from Glow: Generative Flow with Invert

PyTorch implementations of Generative Adversarial Networks.
PyTorch implementations of Generative Adversarial Networks.

This repository has gone stale as I unfortunately do not have the time to maintain it anymore. If you would like to continue the development of it as

PyTorch implementations of neural network models for keyword spotting
PyTorch implementations of neural network models for keyword spotting

Honk: CNNs for Keyword Spotting Honk is a PyTorch reimplementation of Google's TensorFlow convolutional neural networks for keyword spotting, which ac

PyTorch implementations for our SIGGRAPH 2021 paper: Editable Free-viewpoint Video Using a Layered Neural Representation.
PyTorch implementations for our SIGGRAPH 2021 paper: Editable Free-viewpoint Video Using a Layered Neural Representation.

st-nerf We provide PyTorch implementations for our paper: Editable Free-viewpoint Video Using a Layered Neural Representation SIGGRAPH 2021 Jiakai Zha

ilpyt: imitation learning library with modular, baseline implementations in Pytorch
ilpyt: imitation learning library with modular, baseline implementations in Pytorch

ilpyt The imitation learning toolbox (ilpyt) contains modular implementations of common deep imitation learning algorithms in PyTorch, with unified in

A lightweight library to compare different PyTorch implementations of the same network architecture.
A lightweight library to compare different PyTorch implementations of the same network architecture.

TorchBug is a lightweight library designed to compare two PyTorch implementations of the same network architecture. It allows you to count, and compar

Comments
  • build issues - cuda headers

    build issues - cuda headers

    Hey, thanks for setting things up! I don't seem to be able to build properly, as I keep getting an error with the location of the cuda headers.

    $   ./make.sh                                                                                                                                                         
    Compiling functions using nvcc...
    Compiled, now linking...
    Generating sanitized versions of internals for C compilation...
    Building python interface to CUDA code
    Including CUDA code.
    generating /tmp/tmpb1XVOD/_functions.c
    running build_ext
    building '_functions' extension
    creating home
    creating home/<u>
    creating home/<u>/repos
    creating home/<u>/repos/lgamma
    creating home/<u>/repos/lgamma/src
    x86_64-pc-linux-gnu-gcc -pthread -fPIC -DWITH_CUDA -I/home/<u>/.virtualenvs/pytorch/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include -I/home/<u>/.virtualenvs/pytorch/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/<u>/.virtualenvs/pytorch/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/include/python2.7 -c _functions.c -o ./_functions.o -std=gnu11
    In file included from /home/<u>/.virtualenvs/pytorch/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include/THC/THC.h:4:0,
                     from _functions.c:434:
    /home/<u>/.virtualenvs/pytorch/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include/THC/THCGeneral.h:9:18: fatal error: cuda.h: No such file or directory
     #include "cuda.h"
                      ^
    compilation terminated.
    Traceback (most recent call last):
      File "build.py", line 44, in <module>
        ffi.build()
      File "/home/<u>/.virtualenvs/pytorch/lib/python2.7/site-packages/torch/utils/ffi/__init__.py", line 164, in build
        _build_extension(ffi, cffi_wrapper_name, target_dir, verbose)
      File "/home/<u>/.virtualenvs/pytorch/lib/python2.7/site-packages/torch/utils/ffi/__init__.py", line 100, in _build_extension
        ffi.compile(tmpdir=tmpdir, verbose=verbose, target=libname)
      File "/home/<u>/.virtualenvs/pytorch/lib/python2.7/site-packages/cffi/api.py", line 684, in compile
        compiler_verbose=verbose, debug=debug, **kwds)
      File "/home/<u>/.virtualenvs/pytorch/lib/python2.7/site-packages/cffi/recompiler.py", line 1484, in recompile
        compiler_verbose, debug)
      File "/home/<u>/.virtualenvs/pytorch/lib/python2.7/site-packages/cffi/ffiplatform.py", line 20, in compile
        outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
      File "/home/<u>/.virtualenvs/pytorch/lib/python2.7/site-packages/cffi/ffiplatform.py", line 56, in _build
        raise VerificationError('%s: %s' % (e.__class__.__name__, e))
    cffi.error.VerificationError: CompileError: command 'x86_64-pc-linux-gnu-gcc' failed with exit status 1
    

    I did change make.sh to point it to the correct cuda location as well.. (I also removed the hard-coding of gpu architecture to let my compile autodetect; it's what's worked for me before)

    diff --git a/make.sh b/make.sh
    index c26d274..a514923 100755
    --- a/make.sh
    +++ b/make.sh
    @@ -11,13 +11,13 @@ rm -f internals_s.c internals_s.h
     echo "Compiling functions using nvcc..."
     
     # force compilation in CUDA/C++ mode
    -nvcc -c -dc --shared functions_cuda_kernel.cu -x cu -arch=sm_35 -Xcompiler -fPIC -lcudadevrt -lcudart -o functions_cuda_kernel.cu.o -D __BOTH__='__device__ __host__'
    -nvcc -c -dc --shared internals.c -x cu -arch=sm_35 -Xcompiler -fPIC -lcudadevrt -lcudart -o internals.cu.o -D __BOTH__='__device__ __host__' -include cfloat
    +nvcc -c -dc --shared functions_cuda_kernel.cu -x cu -Xcompiler -fPIC -lcudadevrt -lcudart -o functions_cuda_kernel.cu.o -D __BOTH__='__device__ __host__'
    +nvcc -c -dc --shared internals.c -x cu -Xcompiler -fPIC -lcudadevrt -lcudart -o internals.cu.o -D __BOTH__='__device__ __host__' -include cfloat
     
     echo "Compiled, now linking..."
     
     # required intermediate device code link step
    -nvcc -arch=sm_35 -dlink functions_cuda_kernel.cu.o internals.cu.o -o functions.link.cu.o -Xcompiler -fPIC -lcudadevrt -lcudart
    +nvcc -dlink functions_cuda_kernel.cu.o internals.cu.o -o functions.link.cu.o -Xcompiler -fPIC -lcudadevrt -lcudart
     
     echo "Generating sanitized versions of internals for C compilation..."
     
    @@ -27,4 +27,4 @@ sed "s/__BOTH__//" internals.h > internals_s.h
     cd ../
     
     echo "Building python interface to CUDA code"
    -python build.py
    +python build.py --cuda-path /opt/cuda/lib
    

    It doesn't appear to matter whether the path is /opt/cuda or /opt/cuda/lib or even the pytorch specific cuda path from the locate call below, I get the same error shown above.

    $   locate libcudart.so
    /home/<u>/.virtualenvs/pytorch/lib/python2.7/site-packages/torch/lib/libcudart.so
    /home/<u>/.virtualenvs/pytorch/lib/python2.7/site-packages/torch/lib/libcudart.so.7.5
    /opt/cuda/lib/libcudart.so
    /opt/cuda/lib/libcudart.so.7.5
    /opt/cuda/lib/libcudart.so.7.5.18
    /opt/cuda/lib64/libcudart.so
    /opt/cuda/lib64/libcudart.so.7.5
    /opt/cuda/lib64/libcudart.so.7.5.18
    
    opened by iffsid 1
  • Test fails for FloatTensor

    Test fails for FloatTensor

    Awesome project, but here's a bug! If I change the TensorType to torch.cuda.FloatTensor in test.py then the gradient check test fails for me (works fine w/ DoubleTensor). So it seems like the implementation is correct only for the DoubleTensor type.

    opened by bogdanstate 5
Owner
Rachit Singh
Rachit Singh
git《Beta R-CNN: Looking into Pedestrian Detection from Another Perspective》(NeurIPS 2020) GitHub:[fig3]

Beta R-CNN: Looking into Pedestrian Detection from Another Perspective This is the pytorch implementation of our paper "[Beta R-CNN: Looking into Pede

null 35 Sep 8, 2021
Boundary IoU API (Beta version)

Boundary IoU API (Beta version) Bowen Cheng, Ross Girshick, Piotr Dollár, Alexander C. Berg, Alexander Kirillov [arXiv] [Project] [BibTeX] This API is

Bowen Cheng 177 Dec 29, 2022
Pytorch Lightning 1.2k Jan 6, 2023
PyTorch implementations of deep reinforcement learning algorithms and environments

Deep Reinforcement Learning Algorithms with PyTorch This repository contains PyTorch implementations of deep reinforcement learning algorithms and env

Petros Christodoulou 4.7k Jan 4, 2023
Annotated, understandable, and visually interpretable PyTorch implementations of: VAE, BIRVAE, NSGAN, MMGAN, WGAN, WGANGP, LSGAN, DRAGAN, BEGAN, RaGAN, InfoGAN, fGAN, FisherGAN

Overview PyTorch 0.4.1 | Python 3.6.5 Annotated implementations with comparative introductions for minimax, non-saturating, wasserstein, wasserstein g

Shayne O'Brien 471 Dec 16, 2022
Pytorch implementations of popular off-policy multi-agent reinforcement learning algorithms, including QMix, VDN, MADDPG, and MATD3.

Off-Policy Multi-Agent Reinforcement Learning (MARL) Algorithms This repository contains implementations of various off-policy multi-agent reinforceme

null 183 Dec 28, 2022
Independent and minimal implementations of some reinforcement learning algorithms using PyTorch (including PPO, A3C, A2C, ...).

PyTorch RL Minimal Implementations There are implementations of some reinforcement learning algorithms, whose characteristics are as follow: Less pack

Gemini Light 4 Dec 31, 2022
Pytorch Implementations of large number classical backbone CNNs, data enhancement, torch loss, attention, visualization and some common algorithms.

Torch-template-for-deep-learning Pytorch implementations of some **classical backbone CNNs, data enhancement, torch loss, attention, visualization and

Li Shengyan 270 Dec 31, 2022
PyTorch implementations of the paper: "DR.VIC: Decomposition and Reasoning for Video Individual Counting, CVPR, 2022"

DRNet for Video Indvidual Counting (CVPR 2022) Introduction This is the official PyTorch implementation of paper: DR.VIC: Decomposition and Reasoning

tao han 35 Nov 22, 2022
StudioGAN is a Pytorch library providing implementations of representative Generative Adversarial Networks (GANs) for conditional/unconditional image generation.

StudioGAN is a Pytorch library providing implementations of representative Generative Adversarial Networks (GANs) for conditional/unconditional image generation.

null 3k Jan 8, 2023