Class OnnxSparseTensor.SparseTensor<T extends Buffer>

java.lang.Object
ai.onnxruntime.OnnxSparseTensor.SparseTensor<T>
Type Parameters:
T - The type of the indices buffer.
Direct Known Subclasses:
OnnxSparseTensor.BlockSparseTensor, OnnxSparseTensor.COOTensor, OnnxSparseTensor.CSRCTensor
Enclosing class:
OnnxSparseTensor

public abstract static class OnnxSparseTensor.SparseTensor<T extends Buffer> extends Object
Abstract base class for Java sparse tensors

Will be sealed to OnnxSparseTensor.COOTensor, OnnxSparseTensor.CSRCTensor and OnnxSparseTensor.BlockSparseTensor one day.

  • Method Details

    • getDenseShape

      public long[] getDenseShape()
      Gets the dense shape of the sparse tensor.
      Returns:
      The sparse tensor shape.
    • getType

      public OnnxJavaType getType()
      The data type of the sparse tensor.
      Returns:
      The sparse tensor data type.
    • getNumNonZeroElements

      public long getNumNonZeroElements()
      The number of non-zero elements.
      Returns:
      The number of non-zero elements.
    • getIndices

      public T getIndices()
      Get the indices buffer.
      Returns:
      The indices buffer.
    • getValues

      public Buffer getValues()
      Get the value buffer.
      Returns:
      The value buffer.
    • getValuesShape

      public long[] getValuesShape()
      Gets the shape of the values of the sparse tensor.
      Returns:
      The sparse tensor value shape.
    • getIndicesShape

      public long[] getIndicesShape()
      Gets the shape of the indices of the sparse tensor.
      Returns:
      The sparse tensor indices shape.
    • getSparsityType

      public abstract OnnxSparseTensor.SparseTensorType getSparsityType()
      The sparsity type of the sparse tensor.
      Returns:
      The sparse tensor sparsity type.
    • getIndicesType

      public abstract OnnxJavaType getIndicesType()
      The indices type of the sparse tensor.

      Only OnnxJavaType.INT32 and OnnxJavaType.INT64 are supported.

      Returns:
      The sparse tensor indices type.