Package ai.onnxruntime
Class OnnxSparseTensor.SparseTensor<T extends java.nio.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 java.nio.Buffer> extends java.lang.Object
Abstract base class for Java sparse tensorsWill be sealed to
OnnxSparseTensor.COOTensor
,OnnxSparseTensor.CSRCTensor
andOnnxSparseTensor.BlockSparseTensor
one day.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description long[]
getDenseShape()
Gets the dense shape of the sparse tensor.T
getIndices()
Get the indices buffer.long[]
getIndicesShape()
Gets the shape of the indices of the sparse tensor.abstract OnnxJavaType
getIndicesType()
The indices type of the sparse tensor.long
getNumNonZeroElements()
The number of non-zero elements.abstract OnnxSparseTensor.SparseTensorType
getSparsityType()
The sparsity type of the sparse tensor.OnnxJavaType
getType()
The data type of the sparse tensor.java.nio.Buffer
getValues()
Get the value buffer.long[]
getValuesShape()
Gets the shape of the values of the sparse tensor.
-
-
-
Method Detail
-
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 java.nio.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
andOnnxJavaType.INT64
are supported.- Returns:
- The sparse tensor indices type.
-
-