IValue
-
public class
IValue
Java representation of a TorchScript value, which is implemented as tagged union that can be one of the supported types: https://pytorch.org/docs/stable/jit.html#types .
Calling
toX
methods for inappropriate types will throwIllegalStateException
.IValue
objects are constructed withIValue.from(value)
,IValue.tupleFrom(value1, value2, ...)
,IValue.listFrom(value1, value2, ...)
, or one of thedict
methods, depending on the key type.Data is retrieved from
IValue
objects with thetoX()
methods. Note thatstr
-type IValues must be extracted withtoStr()
, rather thantoString()
.IValue
objects may retain references to objects passed into their constructors, and may return references to their internal state fromtoX()
.
Methods
from
-
public static IValue
from
(boolean value) Creates a new
IValue
of typebool
.
from
-
public static IValue
from
(long value) Creates a new
IValue
of typeint
.
from
-
public static IValue
from
(double value) Creates a new
IValue
of typefloat
.
listFrom
-
public static IValue
listFrom
(boolean... list) Creates a new
IValue
of typeList[bool]
.
listFrom
-
public static IValue
listFrom
(long... list) Creates a new
IValue
of typeList[int]
.
listFrom
-
public static IValue
listFrom
(double... list) Creates a new
IValue
of typeList[float]
.
optionalNull
-
public static IValue
optionalNull
() Creates a new
IValue
of typeOptional
that contains no value.
toList
-
public IValue[]
toList
()
toStr
-
public String
toStr
()
toTensor
-
public Tensor
toTensor
()
toTensorList
-
public Tensor[]
toTensorList
()
toTuple
-
public IValue[]
toTuple
()