public class TensorInfo extends java.lang.Object implements ValueInfo
OnnxTensor, including it's size, shape and element type.| Modifier and Type | Class and Description |
|---|---|
static class |
TensorInfo.OnnxTensorType
The native element types supported by the ONNX runtime.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_DIMENSIONS
Maximum number of dimensions supported by the Java interface methods.
|
TensorInfo.OnnxTensorType |
onnxType
The native type of this tensor.
|
OnnxJavaType |
type
The Java type of this tensor.
|
| Modifier and Type | Method and Description |
|---|---|
static TensorInfo |
constructFromBuffer(java.nio.Buffer buffer,
long[] shape,
OnnxJavaType type)
Constructs a TensorInfo from the supplied byte buffer.
|
static TensorInfo |
constructFromJavaArray(java.lang.Object obj)
Constructs a TensorInfo from the supplied multidimensional Java array,
used to allocate the appropriate amount of native memory.
|
long[] |
getShape()
Get a copy of the tensor's shape.
|
boolean |
isScalar()
Returns true if the shape represents a scalar value (i.e.
|
java.lang.Object |
makeCarrier()
Constructs an array the right shape and type to hold this tensor.
|
java.lang.String |
toString() |
public static final int MAX_DIMENSIONS
public final OnnxJavaType type
public final TensorInfo.OnnxTensorType onnxType
public long[] getShape()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isScalar()
public java.lang.Object makeCarrier()
throws OrtException
OrtException - If the shape isn't representable in Java (i.e. if one of it's indices is greater than an int).public static TensorInfo constructFromJavaArray(java.lang.Object obj) throws OrtException
obj - The object to inspect.OrtException - If the supplied Object isn't an array, or is an invalid type.public static TensorInfo constructFromBuffer(java.nio.Buffer buffer, long[] shape, OnnxJavaType type) throws OrtException
buffer - The buffer to inspect.shape - The shape of the tensor.type - The Java type.OrtException - If the supplied buffer doesn't match the shape.