smrfeld / pytorch-cpp-tutorial

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. (Optional) Create a conda environment:

    conda create -n test-pytorch-cpp python=3.11
    conda activate test-pytorch-cpp
  2. Install requirements:

    pip install -r requirements.txt
  3. Install package using setup.py:

    pip install -e .
  4. Run the test:

    python main.py

    Expected result:

    tensor([5., 7., 9.])
    

About

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

License:MIT License


Languages

Language:Python 65.1%Language:C++ 34.9%