An open API service indexing awesome lists of open source software.

https://github.com/smrfeld/pytorch-cpp-tutorial

Tutorial for Python package calling a custom PyTorch C++ module
https://github.com/smrfeld/pytorch-cpp-tutorial

cplusplus cppextension pybind11 python pytorch

Last synced: 11 months ago
JSON representation

Tutorial for Python package calling a custom PyTorch C++ module

Awesome Lists containing this project

README

          

# Tutorial for Python package calling a custom PyTorch C++ module

This is a minimal example of a Python package calling a custom PyTorch C++ module.

## Installing & running

0. (Optional) Create a conda environment:

```bash
conda create -n test-pytorch-cpp python=3.11
conda activate test-pytorch-cpp
```

1. Install requirements:
```bash
pip install -r requirements.txt
```

2. Install package using `setup.py`:
```bash
pip install -e .
```

3. Run the test:
```bash
python main.py
```
Expected result:
```
tensor([5., 7., 9.])
```