Class ByteBufferDenseTensor

java.lang.Object
com.linkedin.feathr.common.tensor.DenseTensor
com.linkedin.feathr.common.tensor.dense.ByteBufferDenseTensor
All Implemented Interfaces:
TensorData
Direct Known Subclasses:
DenseBooleanTensor, DenseBytesTensor, DenseDoubleTensor, DenseFloatTensor, DenseIntTensor, DenseLongTensor, DenseStringTensor

public abstract class ByteBufferDenseTensor extends DenseTensor
Base class for dense int/float/double/long/boolean/string/byte[] tensors backed by a ByteBuffer using TensorFlow-compatible layout.
  • Field Details

    • _byteBuffer

      protected final ByteBuffer _byteBuffer
    • _start

      protected final int _start
    • _limit

      protected final int _limit
    • _shape

      protected final long[] _shape
    • _cardinality

      protected final int _cardinality
    • _types

      protected final Representable[] _types
  • Constructor Details

    • ByteBufferDenseTensor

      public ByteBufferDenseTensor(ByteBuffer byteBuffer, long[] shape, Primitive type, int bytes)
  • Method Details

    • getByteBuffer

      public ByteBuffer getByteBuffer()
    • getByteBuffer

      public ByteBuffer getByteBuffer(boolean makeCopy)
    • getShape

      public long[] getShape()
      Returns:
      the current shape of the data or the supplied shape of the data
    • getTypes

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

      public 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

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