Package org.pytorch
Class LiteModuleLoader
- java.lang.Object
-
- org.pytorch.LiteModuleLoader
-
public class LiteModuleLoader extends Object
-
-
Constructor Summary
Constructors Constructor Description LiteModuleLoader()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Module
load(String modelPath)
Loads a serialized TorchScript module from the specified path on the disk to run on CPU.static Module
load(String modelPath, Map<String,String> extraFiles, Device device)
Loads a serialized TorchScript module from the specified path on the disk to run on specified device.static Module
loadModuleFromAsset(AssetManager assetManager, String assetName)
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.
-
-
-
Method Detail
-
load
public static Module load(String modelPath, Map<String,String> extraFiles, Device device)
Loads a serialized TorchScript module from the specified path on the disk to run on specified device. The model should be generated from this api _save_for_lite_interpreter().
-
load
public static Module load(String modelPath)
Loads a serialized TorchScript module from the specified path on the disk to run on CPU. The model should be generated from this api _save_for_lite_interpreter().- Parameters:
modelPath
- path to file that contains the serialized TorchScript module.- Returns:
- new
Module
object which owns torch::jit::mobile::Module.
-
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 diskModule.load(String)
.This method is meant to use in tests and demos.
-
loadModuleFromAsset
public static Module loadModuleFromAsset(AssetManager assetManager, String assetName)
-
-