public class IValue
extends java.lang.Object
Calling toX methods for inappropriate types will throw IllegalStateException.
IValue objects are constructed with IValue.from(value), IValue.tupleFrom(value1, value2, ...), IValue.listFrom(value1, value2, ...), or one of
the dict methods, depending on the key type.
Data is retrieved from IValue objects with the toX() methods. Note that str-type IValues must be extracted with toStr(), rather than Object.toString().
IValue objects may retain references to objects passed into their constructors, and
may return references to their internal state from toX().
| Modifier and Type | Method and Description |
|---|---|
static IValue |
dictLongKeyFrom(java.util.Map<java.lang.Long,IValue> map)
Creates a new
IValue of type Dict[int, V]. |
static IValue |
dictStringKeyFrom(java.util.Map<java.lang.String,IValue> map)
Creates a new
IValue of type Dict[str, V]. |
static IValue |
from(boolean value)
Creates a new
IValue of type bool. |
static IValue |
from(double value)
Creates a new
IValue of type float. |
static IValue |
from(long value)
Creates a new
IValue of type int. |
static IValue |
from(java.lang.String value)
Creates a new
IValue of type str. |
static IValue |
from(Tensor tensor)
Creates a new
IValue of type Tensor. |
boolean |
isBool() |
boolean |
isBoolList() |
boolean |
isDictLongKey() |
boolean |
isDictStringKey() |
boolean |
isDouble() |
boolean |
isDoubleList() |
boolean |
isList() |
boolean |
isLong() |
boolean |
isLongList() |
boolean |
isNull() |
boolean |
isString() |
boolean |
isTensor() |
boolean |
isTensorList() |
boolean |
isTuple() |
static IValue |
listFrom(boolean... list)
Creates a new
IValue of type List[bool]. |
static IValue |
listFrom(double... list)
Creates a new
IValue of type List[float]. |
static IValue |
listFrom(IValue... array)
Creates a new
IValue of type List[T]. |
static IValue |
listFrom(long... list)
Creates a new
IValue of type List[int]. |
static IValue |
listFrom(Tensor... list)
Creates a new
IValue of type List[Tensor]. |
static IValue |
optionalNull()
Creates a new
IValue of type Optional that contains no value. |
boolean |
toBool() |
boolean[] |
toBoolList() |
java.util.Map<java.lang.Long,IValue> |
toDictLongKey() |
java.util.Map<java.lang.String,IValue> |
toDictStringKey() |
double |
toDouble() |
double[] |
toDoubleList() |
IValue[] |
toList() |
long |
toLong() |
long[] |
toLongList() |
java.lang.String |
toStr() |
Tensor |
toTensor() |
Tensor[] |
toTensorList() |
IValue[] |
toTuple() |
static IValue |
tupleFrom(IValue... array)
Creates a new
IValue of type Tuple[T0, T1, ...]. |
public boolean isNull()
public boolean isTensor()
public boolean isBool()
public boolean isLong()
public boolean isDouble()
public boolean isString()
public boolean isTuple()
public boolean isBoolList()
public boolean isLongList()
public boolean isDoubleList()
public boolean isTensorList()
public boolean isList()
public boolean isDictStringKey()
public boolean isDictLongKey()
public static IValue optionalNull()
IValue of type Optional that contains no value.public static IValue from(boolean value)
IValue of type bool.public static IValue from(long value)
IValue of type int.public static IValue from(double value)
IValue of type float.public static IValue from(java.lang.String value)
IValue of type str.public static IValue listFrom(boolean... list)
IValue of type List[bool].public static IValue listFrom(long... list)
IValue of type List[int].public static IValue listFrom(double... list)
IValue of type List[float].public static IValue listFrom(IValue... array)
IValue of type List[T]. All elements must have the same type.public static IValue tupleFrom(IValue... array)
IValue of type Tuple[T0, T1, ...].public static IValue dictStringKeyFrom(java.util.Map<java.lang.String,IValue> map)
IValue of type Dict[str, V].public static IValue dictLongKeyFrom(java.util.Map<java.lang.Long,IValue> map)
IValue of type Dict[int, V].public Tensor toTensor()
public boolean toBool()
public long toLong()
public double toDouble()
public java.lang.String toStr()
public boolean[] toBoolList()
public long[] toLongList()
public double[] toDoubleList()
public Tensor[] toTensorList()
public IValue[] toList()
public IValue[] toTuple()
public java.util.Map<java.lang.String,IValue> toDictStringKey()
public java.util.Map<java.lang.Long,IValue> toDictLongKey()