PyTorch Java Demo
This repository is a demonstration of how to use PyTorch from Java.
Setup
Download and unpack libtorch nightly (or 1.4 or greater once it is released).
From the pytorch.org homepage under "Quick Start Locally",
make sure "LibTorch" is the selected package.
As of this writing, only Linux is supported. Mac and Windows will follow.
Change java.library.path in build.gradle to /path/to/libtorch/lib.
Run ./gradlew run to build and run the demo application.
It will load demo-model.pt and run it on some simple data.
More information about the Java API and TorchScript: