java.lang.Object
java.lang.Record
uk.ac.manchester.tornado.api.types.tensors.Shape
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong[]Returns the value of thedimensionsrecord component.booleanIndicates whether some other object is "equal to" this one.long[]Returns of the dimensions of the shape.intgetRank()Returns the rank of the shape, which is the number of dimensions.intgetSize()Calculates and returns the size of the shape, which is the product of all its dimensions.inthashCode()Returns a hash code value for this object.Generates a string representation of the shape compatible with ONNX's shape format.toString()Returns a string representation of this record class.Generates a string representation of the shape compatible with TensorFlow's shape format.
-
Constructor Details
-
Shape
public Shape(long... dimensions) Creates an instance of aShaperecord class.- Parameters:
dimensions- the value for thedimensionsrecord component
-
-
Method Details
-
getRank
public int getRank()Returns the rank of the shape, which is the number of dimensions.- Returns:
- the number of dimensions of the shape
-
getDimensions
public long[] getDimensions()Returns of the dimensions of the shape.- Returns:
- an array of long values representing the dimensions of the shape
-
getSize
public int getSize()Calculates and returns the size of the shape, which is the product of all its dimensions.- Returns:
- the total size of the shape as an int
-
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). -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
toTensorFlowShapeString
Generates a string representation of the shape compatible with TensorFlow's shape format.- Returns:
- a string representing the shape in TensorFlow's format
-
toONNXShapeString
Generates a string representation of the shape compatible with ONNX's shape format.- Returns:
- a string representing the shape in ONNX's format
-
dimensions
public long[] dimensions()Returns the value of thedimensionsrecord component.- Returns:
- the value of the
dimensionsrecord component
-