Class PrimitiveDimensionType

java.lang.Object
com.linkedin.feathr.common.tensor.DimensionType
com.linkedin.feathr.common.tensor.PrimitiveDimensionType
All Implemented Interfaces:
Representable, Serializable

public final class PrimitiveDimensionType extends DimensionType
The most basic type of a dimension. Only specifies the primitive type and an optional shape ("size"), without any high-level metadata.
See Also:
  • Field Details

  • Constructor Details

    • PrimitiveDimensionType

      public PrimitiveDimensionType(Primitive primitive, int shape)
    • PrimitiveDimensionType

      public PrimitiveDimensionType(Primitive primitive)
  • Method Details

    • withShape

      public PrimitiveDimensionType withShape(int shape)
      Parameters:
      shape - the shape of the new type.
      Returns:
      a copy of this type with a new shape.
    • getShape

      public int getShape()
      Description copied from class: DimensionType
      Get the shape.
      Overrides:
      getShape in class DimensionType
      Returns:
      the shape - the number of maximum possible unique values in this dimension. Can be UNKNOWN_SHAPE.
    • getRepresentation

      public Primitive getRepresentation()
    • getName

      public String getName()
      Description copied from class: DimensionType
      Get the name of the DimensionType
      Overrides:
      getName in class DimensionType
      Returns:
      the name
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • setDimensionValue

      public void setDimensionValue(WriteableTuple target, int column, Object dimensionValue)
      Description copied from class: DimensionType
      Sets a dimension in a particular column of a target tuple. For primitive dimensions, implementations will just copy the value over. (This is the default behavior.) For high-level semantic dimensions that maintain a different set of "outward-facing" and "internal" representations of the dimension values, implementations will apply any necessary translation on the input dimensionValue before inserting into the tuple.
      Overrides:
      setDimensionValue in class DimensionType
      Parameters:
      target - the destination where the dimension value should be set. Hint: This will often be a com.linkedin.feathr.common.TensorBuilder
      column - the column number of the target tuple to be set
      dimensionValue - the value of the dimension
    • toString

      public String toString()
      Overrides:
      toString in class Object