public class Module
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Explicitly destroys the native torch::jit::Module.
|
IValue |
forward(IValue... inputs)
Runs the 'forward' method of this module with the specified arguments.
|
static Module |
load(java.lang.String modelPath)
Loads a serialized TorchScript module from the specified path on the disk to run on CPU.
|
static Module |
load(java.lang.String modelPath,
java.util.Map<java.lang.String,java.lang.String> extraFiles,
Device device)
Loads a serialized TorchScript module from the specified path on the disk to run on specified
device.
|
IValue |
runMethod(java.lang.String methodName,
IValue... inputs)
Runs the specified method of this module with the specified arguments.
|
public static Module load(java.lang.String modelPath, java.util.Map<java.lang.String,java.lang.String> extraFiles, Device device)
public static Module load(java.lang.String modelPath)
modelPath
- path to file that contains the serialized TorchScript module.Module
object which owns torch::jit::Module.public IValue forward(IValue... inputs)
inputs
- arguments for the TorchScript module's 'forward' method.public IValue runMethod(java.lang.String methodName, IValue... inputs)
methodName
- name of the TorchScript method to run.inputs
- arguments that will be passed to TorchScript method.public void destroy()
destroy
can free memory
more quickly. See HybridData.resetNative()
.