Class TensorType
java.lang.Object
com.linkedin.feathr.common.tensor.TensorType
- All Implemented Interfaces:
Serializable
Type definition for a TypedTensor, defines the value type, dimension types and dimension names.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTensorType(TensorCategory tensorCategory, ValueType valueType, List<DimensionType> dimensionTypes) TensorType(TensorCategory tensorCategory, ValueType valueType, List<DimensionType> dimensionTypes, List<String> dimensionNames) TensorType(ValueType valueType, List<DimensionType> dimensionTypes) Create a SPARSE tensor type with default local names for dimensions.TensorType(ValueType valueType, List<DimensionType> dimensionTypes, List<String> dimensionNames) Create a SPARSE tensor type. -
Method Summary
Modifier and TypeMethodDescriptionbooleanWARNING: this returns primitive representations, not DimensionType/ValueType.intint[]getShape()inthashCode()voidsetDimensions(WriteableTuple target, Object[] dimensions) toString()
-
Field Details
-
EMPTY
-
-
Constructor Details
-
TensorType
Create a SPARSE tensor type with default local names for dimensions.- Parameters:
valueType- the type of the value contained in the tensor.dimensionTypes- a sequence of types for all dimensions of the tensor (can be empty). Dimension names will default to names taken from dimensionTypes.
-
TensorType
public TensorType(ValueType valueType, List<DimensionType> dimensionTypes, List<String> dimensionNames) Create a SPARSE tensor type.- Parameters:
valueType- the type of the value contained in the tensor.dimensionTypes- a sequence of types for all dimensions of the tensor (can be empty).dimensionNames- are local to the TensorType, allowing to differentiate between multiple instances of the same dimension type, for example, x used for both viewer and viewee. If null, defaults to names taken from dimensionTypes.
-
TensorType
public TensorType(TensorCategory tensorCategory, ValueType valueType, List<DimensionType> dimensionTypes, List<String> dimensionNames) - Parameters:
tensorCategory- the category of the tensor type, such as dense, sparse, etc. NOTE: at the moment this is stored as is, and no additional validation is guaranteed (such as choosing the right tensor builder based on the tensor category).valueType- the type of the value contained in the tensor.dimensionTypes- a sequence of types for all dimensions of the tensor (can be empty).dimensionNames- are local to the TensorType, allowing to differentiate between multiple instances of the same dimension type, for example, x used for both viewer and viewee. If null, defaults to names taken from dimensionTypes.
-
TensorType
public TensorType(TensorCategory tensorCategory, ValueType valueType, List<DimensionType> dimensionTypes) - Parameters:
tensorCategory- the category of the tensor type, such as dense, sparse, etc. NOTE: at the moment this is stored as is, and no additional validation is guaranteed (such as choosing the right tensor builder based on the tensor category).valueType- the type of the value contained in the tensor.dimensionTypes- a sequence of types for all dimensions of the tensor (can be empty).
-
-
Method Details
-
getTensorCategory
- Returns:
- the category of this tensor. NOTE: only use in context of the FDS until adopted elsewhere. This defaults to SPARSE if not specified in constructor.
-
getValueType
-
getDimensionTypes
-
getDimensionNames
-
getColumnTypes
WARNING: this returns primitive representations, not DimensionType/ValueType.- Returns:
- Dimension types followed by a value type.
-
setDimensions
-
getShape
public int[] getShape() -
getDenseSize
public int getDenseSize() -
equals
-
hashCode
public int hashCode() -
toString
-