Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frgfm/torch-cuda-template
Template for CUDA / C++ extension writing with PyTorch
https://github.com/frgfm/torch-cuda-template
cpp cuda pytorch pytorch-extension
Last synced: 2 months ago
JSON representation
Template for CUDA / C++ extension writing with PyTorch
- Host: GitHub
- URL: https://github.com/frgfm/torch-cuda-template
- Owner: frgfm
- License: mit
- Created: 2020-09-08T20:47:59.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-09T12:55:44.000Z (over 4 years ago)
- Last Synced: 2024-11-22T13:07:11.303Z (3 months ago)
- Topics: cpp, cuda, pytorch, pytorch-extension
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# torch-cuda-template
[![License](https://img.shields.io/badge/License-MIT-brightgreen.svg)](LICENSE) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/9a56f466d21f4dbf8de677fd5b8709d3)](https://www.codacy.com/manual/frgfm/torch-cuda-template?utm_source=github.com&utm_medium=referral&utm_content=frgfm/torch-cuda-template&utm_campaign=Badge_Grade)![Build Status](https://github.com/frgfm/torch-cuda-template/workflows/python-package/badge.svg) [![codecov](https://codecov.io/gh/frgfm/torch-cda-template/branch/master/graph/badge.svg)](https://codecov.io/gh/frgfm/torch-cuda-template)Template for CUDA / C++ extension writing with PyTorch
## Table of Contents
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)## Getting started
### Prerequisites
- Python 3.6 (or more recent)
- [pip](https://pip.pypa.io/en/stable/)### Installation
You can install the package using the default method:
```bash
pip install -e . --upgrade
```which will build the CUDA extension and bind it with your python module.
## Usage
This python package can be used like any other:
```python
import torch
import cuda_ext.nn as nnmy_module = nn.DSigmoid()
with torch.no_grad():
out = my_module(torch.rand(2, 3, 32, 32).cuda())
```## Contributing
Please refer to `CONTRIBUTING` if you wish to contribute to this project.
## Credits
The content of this repo was brought together by the repo owner but highly benefited from the following resources:
- CUDA extensions of [Thomas Brandon](https://github.com/thomasbrandon)
- Official PyTorch [documentation](https://pytorch.org/tutorials/advanced/cpp_extension.html)## License
Distributed under the MIT License. See `LICENSE` for more information.