Package ai.djl.mxnet.engine
Class CachedOp
java.lang.Object
ai.djl.util.NativeResource<com.sun.jna.Pointer>
ai.djl.mxnet.engine.CachedOp
- All Implemented Interfaces:
AutoCloseable
public class CachedOp
extends ai.djl.util.NativeResource<com.sun.jna.Pointer>
The
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.
-
Field Summary
Fields inherited from class ai.djl.util.NativeResource
handle -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class ai.djl.util.NativeResource
getHandle, getUid, isReleased, onClose
-
Constructor Details
-
CachedOp
public CachedOp(com.sun.jna.Pointer handle, MxNDManager manager, List<ai.djl.nn.Parameter> parameters, List<Integer> paramIndices, ai.djl.util.PairList<String, Integer> dataIndices) Creates an instance ofCachedOp.It can be created by using
JnaUtils.createCachedOp(MxSymbolBlock, MxNDManager, boolean)- Parameters:
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 location
-
-
Method Details
-
forward
public ai.djl.ndarray.NDList forward(ai.djl.training.ParameterStore parameterStore, ai.djl.ndarray.NDList data, boolean training) Assigns inputs to the empty locations of the input NDArray.- Parameters:
parameterStore- the parameterStoredata- the input inNDListformattraining- true for a training forward pass- Returns:
- an
NDList
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classai.djl.util.NativeResource<com.sun.jna.Pointer>
-