public class CachedOp extends NativeResource
CachedOp is an internal helper that provides the core functionality to execute a
MxSymbolBlock.
We don't recommended users interact with this class directly. Users should use Predictor instead. CachedOp is an operator that simplifies calling and
analyzing the input shape. It requires minimum input to do inference because most of the
information can be obtained from the model itself.
handle| Constructor and Description |
|---|
CachedOp(com.sun.jna.Pointer handle,
MxNDManager manager,
java.util.List<ai.djl.nn.Parameter> parameters,
java.util.List<java.lang.Integer> paramIndices,
ai.djl.util.PairList<java.lang.String,java.lang.Integer> dataIndices)
Creates an instance of
CachedOp. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
ai.djl.ndarray.NDList |
forward(ai.djl.training.ParameterStore parameterStore,
ai.djl.ndarray.NDList data)
Assigns inputs to the empty locations of the input NDArray.
|
finalize, getHandle, getUid, isReleasedpublic CachedOp(com.sun.jna.Pointer handle,
MxNDManager manager,
java.util.List<ai.djl.nn.Parameter> parameters,
java.util.List<java.lang.Integer> paramIndices,
ai.djl.util.PairList<java.lang.String,java.lang.Integer> dataIndices)
CachedOp.
It can be created by using JnaUtils.createCachedOp(MxSymbolBlock, MxNDManager)
handle - the C handle of the CachedOpmanager - the manager used to create the NDArrayparameters - the parameter valuesparamIndices - the parameters required by the model and their corresponding locationdataIndices - the input data names required by the model and their corresponding
locationpublic ai.djl.ndarray.NDList forward(ai.djl.training.ParameterStore parameterStore,
ai.djl.ndarray.NDList data)
parameterStore - the parameterStoredata - the input in NDList formatNDListpublic void close()
close in interface java.lang.AutoCloseableclose in class NativeResource