Torch
nexus-torch is a tensor computation backend for Nexus based on PyTorch.
It uses SWIG to generate the JNI bindings directly from the Torch C/C++ source without the Python part of PyTorch.
Tested environments
- Linux + CUDA 9.1 / 10.0 + PyTorch 1.0.0
Building the binding manually
Prerequisites:
- PyTorch 1.0.0
pip install torch==1.0.0
- SWIG 3.0+
Steps:
- Patch SWIG.
Use the
swig-patch/fix-long.patchfile to patch SWIG: This resolves SWIG issue #646, which incorrectly mapsptrdiff_ttoIntinstead of the correctLongunder 64-bit machines. - Generate JNI shared library: Run
build.shto build the shared library (libjnitorch.so/libjnitorch.dylib).