Class ScalarTensor

java.lang.Object
com.linkedin.feathr.common.tensor.scalar.ScalarTensor
All Implemented Interfaces:
TensorData
Direct Known Subclasses:
ScalarBooleanTensor, ScalarBytesTensor, ScalarDoubleTensor, ScalarFloatTensor, ScalarIntTensor, ScalarLongTensor, ScalarStringTensor

public abstract class ScalarTensor extends Object implements TensorData
A base for all wrappers of scalars. Has arity of 1: 0 dimensions and 1 value. Cardinality is always 1.
  • Constructor Details

    • ScalarTensor

      public ScalarTensor()
  • Method Details

    • wrap

      public static ScalarTensor wrap(Object scalar, Primitive type)
    • wrap

      public static ScalarTensor wrap(Object scalar)
    • getType

      protected final Primitive getType()
    • estimatedCardinality

      public int estimatedCardinality()
      Specified by:
      estimatedCardinality in interface TensorData
      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()
      Specified by:
      cardinality in interface TensorData
      Returns:
      exact number of entries in the mapping from dimensions to values.
    • getShape

      public long[] getShape()
      Specified by:
      getShape in interface TensorData
      Returns:
      the current shape of the data or the supplied shape of the data