PyTorch Java Demo
This repository is a demonstration of how to use PyTorch from Java.
Download and unpack libtorch nightly (or 1.4 or greater). From the pytorch.org homepage under "Quick Start Locally", make sure "LibTorch" is the selected package. Linux is supported as of version 1.4. Mac is supported as of version 1.5. Linux and Mac are both supported in nightly builds. Windows is not supported at this time.
build.gradle file will use this to set
when running the application.
If you are using PyTorch in your own environment,
LIBTORCH_HOME is not necessary.
Instead, you will need to set
If using a nightly build, run
./gradlew run to build and run the demo application.
It will load
demo-model.pt and run it on some simple data.
This notebook was used to generate the model.
More information about the Java API and TorchScript: