setup.py 1.28 KB
Newer Older
anton's avatar
anton committed
1
2
3
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
anton's avatar
anton committed
4
from torch.utils.cpp_extension import BuildExtension, CppExtension, CUDAExtension
5

anton's avatar
anton committed
6
7
8
9
10

with open('requirements.txt') as f:
    requirements = f.read().splitlines()


11
12
setup(
    name='torch_discounted_cumsum',
anton's avatar
anton committed
13
14
    version='1.0.0',
    description='Fast discounted cumulative sums in PyTorch',
anton's avatar
anton committed
15
16
17
18
19
20
    install_requires=requirements,
    python_requires='>=3.6',
    packages=find_packages(),
    author='Anton Obukhov',
    license='BSD',
    url='https://www.github.com/toshas/torch-discounted-cumsum',
21
    ext_modules=[
anton's avatar
anton committed
22
23
24
25
26
27
28
29
30
31
32
33
34
        CppExtension(
            'torch_discounted_cumsum_cpu',
            [
                os.path.join('torch_discounted_cumsum', 'discounted_cumsum_cpu.cpp'),
            ],
        ),
        CUDAExtension(
            'torch_discounted_cumsum_cuda',
            [
                os.path.join('torch_discounted_cumsum', 'discounted_cumsum_cuda.cpp'),
                os.path.join('torch_discounted_cumsum', 'discounted_cumsum_cuda_kernel.cu'),
            ],
        )
35
36
37
    ],
    cmdclass={
        'build_ext': BuildExtension
anton's avatar
anton committed
38
39
40
41
42
43
    },
    keywords=[
        'pytorch', 'discounted', 'cumsum', 'cumulative', 'sum', 'scan', 'differentiable',
        'reinforcement', 'learning', 'rewards', 'time', 'series'
    ],
)