public final class IValueUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static ai.djl.ndarray.NDList |
forward(PtSymbolBlock block,
ai.djl.ndarray.NDList inputs,
boolean isTrain)
Run the forward of PyTorch module.
|
static boolean |
isList(long iValueHandle)
Check IValue is a container of IValue List.
|
static boolean |
isMap(long iValueHandle)
Check IValue is a container of IValue Map.
|
static boolean |
isNDArray(long iValueHandle)
Check IValue is a container of
PtNDArray. |
static boolean |
isNDList(long iValueHandle)
Check IValue is a container of
NDList. |
static boolean |
isString(long iValueHandle)
Check IValue is a container of String.
|
static boolean |
isTuple(long iValueHandle)
Check IValue is a container of IValue Tuple.
|
static long |
iValueFromDict(long[] pointers,
java.lang.String[] names)
Create Dict IValue Pointer from pointer with its key name.
|
static long |
iValueFromList(long[] pointers)
Create List IValue Pointer from pointer array.
|
static long[] |
toIValueArray(long iValueHandle)
Extract IValue to an IValue Array.
|
static java.util.Map<java.lang.Long,java.lang.Long> |
toIValueMap(long iValueHandle)
Extract IValue to a Map.
|
static long |
toIValuePointer(long arrayHandle)
Create IValue Pointer from NDArray.
|
static PtNDArray |
toNDArray(long iValueHandle,
PtNDManager manager)
Extract IValue with a
PtNDArray value. |
static ai.djl.ndarray.NDList |
toNDList(long iValueHandle,
PtNDManager manager)
Extract IValue to
NDList. |
static java.lang.String |
toString(long iValueHandle)
Extract IValue to String.
|
public static long toIValuePointer(long arrayHandle)
arrayHandle - the handle for PyTorch Tensorpublic static long iValueFromList(long[] pointers)
pointers - pointer arraypublic static long iValueFromDict(long[] pointers,
java.lang.String[] names)
pointers - pointer arraynames - the key value of the pointerpublic static boolean isNDArray(long iValueHandle)
PtNDArray.iValueHandle - IValue pointerpublic static boolean isNDList(long iValueHandle)
NDList.iValueHandle - IValue pointerpublic static boolean isList(long iValueHandle)
iValueHandle - IValue pointerpublic static boolean isTuple(long iValueHandle)
iValueHandle - IValue pointerpublic static boolean isMap(long iValueHandle)
iValueHandle - IValue pointerpublic static boolean isString(long iValueHandle)
iValueHandle - IValue pointerpublic static PtNDArray toNDArray(long iValueHandle, PtNDManager manager)
PtNDArray value.iValueHandle - IValue pointermanager - PtNDManager that creates PtNDArrayNDArraypublic static ai.djl.ndarray.NDList toNDList(long iValueHandle,
PtNDManager manager)
NDList.iValueHandle - IValue pointermanager - PtNDManager that creates PtNDArrayNDListpublic static java.lang.String toString(long iValueHandle)
iValueHandle - IValue pointerpublic static long[] toIValueArray(long iValueHandle)
iValueHandle - IValue pointerpublic static java.util.Map<java.lang.Long,java.lang.Long> toIValueMap(long iValueHandle)
iValueHandle - IValue pointerpublic static ai.djl.ndarray.NDList forward(PtSymbolBlock block, ai.djl.ndarray.NDList inputs, boolean isTrain)
block - the block that contains PyTorch moduleinputs - input NDListisTrain - is running on training modeNDList