Package org.pytorch

Class PyTorchAndroid


  • public final class PyTorchAndroid
    extends Object
    • Constructor Detail

      • PyTorchAndroid

        public PyTorchAndroid()
    • Method Detail

      • loadModuleFromAsset

        public static Module loadModuleFromAsset​(AssetManager assetManager,
                                                 String assetName,
                                                 Device device)
        Attention: This is not recommended way of loading production modules, as prepackaged assets increase apk size etc. For production usage consider using loading from file on the disk Module.load(String).

        This method is meant to use in tests and demos.

      • setNumThreads

        public static void setNumThreads​(int numThreads)
        Globally sets the number of threads used on native side. Attention: Has global effect, all modules use one thread pool with specified number of threads.
        Parameters:
        numThreads - number of threads, must be positive number.