Record Class OnnxModel.TensorData

java.lang.Object
java.lang.Record
ai.beestream.jitnn.onnx.OnnxModel.TensorData
Enclosing class:
OnnxModel

public static record OnnxModel.TensorData(String name, long[] dims, int dataType, ByteBuffer raw) extends Record
A tensor stored in the model: dims, element type and its data as little-endian bytes.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TensorData(String name, long[] dims, int dataType, ByteBuffer raw)
    Creates an instance of a TensorData record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the dataType record component.
    long[]
    Returns the value of the dims record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    float[]
    The values as floats (FLOAT, FLOAT16, BFLOAT16, DOUBLE and the integer types).
    final int
    Returns a hash code value for this object.
    long[]
    The values as longs (INT64, INT32, INT8, UINT8, BOOL, and integral floats).
    Returns the value of the name record component.
    int
    The number of elements: the product of the dims.
    raw()
    Returns the value of the raw record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TensorData

      public TensorData(String name, long[] dims, int dataType, ByteBuffer raw)
      Creates an instance of a TensorData record class.
      Parameters:
      name - the value for the name record component
      dims - the value for the dims record component
      dataType - the value for the dataType record component
      raw - the value for the raw record component
  • Method Details

    • numel

      public int numel()
      The number of elements: the product of the dims.
    • floats

      public float[] floats()
      The values as floats (FLOAT, FLOAT16, BFLOAT16, DOUBLE and the integer types).
    • longs

      public long[] longs()
      The values as longs (INT64, INT32, INT8, UINT8, BOOL, and integral floats).
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • dims

      public long[] dims()
      Returns the value of the dims record component.
      Returns:
      the value of the dims record component
    • dataType

      public int dataType()
      Returns the value of the dataType record component.
      Returns:
      the value of the dataType record component
    • raw

      public ByteBuffer raw()
      Returns the value of the raw record component.
      Returns:
      the value of the raw record component