Interface TensorData

All Known Implementing Classes:
ByteBufferDenseTensor, CoercingTensorData, DenseBooleanTensor, DenseBytesTensor, DenseDoubleTensor, DenseFloatTensor, DenseIntTensor, DenseLongTensor, DenseStringTensor, DenseTensor, LOLTensorData, ScalarBooleanTensor, ScalarBytesTensor, ScalarDoubleTensor, ScalarFloatTensor, ScalarIntTensor, ScalarLongTensor, ScalarStringTensor, ScalarTensor, UniversalTensor

public interface TensorData
A typed container of structured data. Maps a (potentially empty) tuple of dimensions to a scalar value. For efficiency, a single object represents the entire data structure. Sequential access is provided via TensorIterator. The typical use of TensorData is:
 TensorData td = ...;
 TensorIterator ti = td.iterator();
 ti.start();
 while (ti.isValid()) {
  ti.getInt(0);
  ti.getFloat(1);
  ti.getInt(2);
 // and others getXXX(),
 // the getXXX(dimensionality) corresponding to the value
  ti.next();
 }
 
  • Method Details

    • getArity

      default int getArity()
      Returns:
      the arity, which is the total number of columns. As columns are dimensions plus a value, arity is by one greater than dimensionality.
    • getTypes

      Representable[] getTypes()
      Returns:
      the types of all dimensions and the value as a single array.
    • estimatedCardinality

      int estimatedCardinality()
      Returns:
      conservative estimate of number of entries in the mapping from dimensions to values. Can be cheaper to evaluate than the exact one.
    • cardinality

      int cardinality()
      Returns:
      exact number of entries in the mapping from dimensions to values.
    • isEmpty

      default boolean isEmpty()
    • iterator

      TensorIterator iterator()
      Returns:
      an iterator over entries in the mapping from dimensions to the value.
    • getShape

      default long[] getShape()
      Returns:
      the current shape of the data or the supplied shape of the data