/pytorch-cpp-tutorial

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

Primary LanguagePythonMIT LicenseMIT

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.])