Record Class TensorInfo
java.lang.Object
java.lang.Record
smile.onnx.TensorInfo
- Record Components:
elementType- the element data type of the tensor.shape- the shape of the tensor. Each element is the size of that dimension, or-1for a dynamic dimension.symbolicDimensions- optional symbolic names for each dimension (may benullor containnullentries for unnamed dimensions).
public record TensorInfo(ElementType elementType, long[] shape, String[] symbolicDimensions)
extends Record
Describes the type and shape of a tensor.
A dimension value of -1 indicates a dynamic (symbolic) dimension
whose size is not known until runtime.
-
Constructor Summary
ConstructorsConstructorDescriptionTensorInfo(ElementType elementType, long[] shape) Constructor without symbolic dimension names.TensorInfo(ElementType elementType, long[] shape, String[] symbolicDimensions) Creates an instance of aTensorInforecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the total number of elements in the tensor, or-1if any dimension is dynamic.Returns the value of theelementTyperecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturnstrueif the tensor has any dynamic dimensions.intrank()Returns the number of dimensions (rank) of this tensor.long[]shape()Returns the value of theshaperecord component.String[]Returns the value of thesymbolicDimensionsrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
TensorInfo
Constructor without symbolic dimension names.- Parameters:
elementType- the element data type.shape- the shape of the tensor.
-
TensorInfo
Creates an instance of aTensorInforecord class.- Parameters:
elementType- the value for theelementTyperecord componentshape- the value for theshaperecord componentsymbolicDimensions- the value for thesymbolicDimensionsrecord component
-
-
Method Details
-
rank
public int rank()Returns the number of dimensions (rank) of this tensor.- Returns:
- the rank.
-
elementCount
public long elementCount()Returns the total number of elements in the tensor, or-1if any dimension is dynamic.- Returns:
- the total element count, or -1.
-
isDynamic
public boolean isDynamic()Returnstrueif the tensor has any dynamic dimensions.- Returns:
- true if any dimension is -1.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
elementType
Returns the value of theelementTyperecord component.- Returns:
- the value of the
elementTyperecord component
-
shape
-
symbolicDimensions
Returns the value of thesymbolicDimensionsrecord component.- Returns:
- the value of the
symbolicDimensionsrecord component
-