Class TensorTypes
java.lang.Object
com.linkedin.feathr.common.tensor.TensorTypes
Utility functions for working with
TensorType-
Method Summary
Modifier and TypeMethodDescriptionstatic TensorTypefromRepresentables(boolean sparse, Representable[] representables) Creates a synthetic TensorType from the information available on TensorData.static TensorTypefromTensorData(TensorData tensorData) Creates a synthetic TensorType from a TensorData.static TensorTypeparseTensorType(String syntax) Creates a TensorType from a string representation of the type.
-
Method Details
-
parseTensorType
Creates a TensorType from a string representation of the type. Intended to simplify creation of automated tests. It is NOT robust (e.g., the only whitespace allowed is the single mandatory space after comma). Some examples: TENSOR[STRING][LONG]:DOUBLE TENSOR [INT(3)]:FLOAT TENSOR :BOOLEAN -
fromRepresentables
Creates a synthetic TensorType from the information available on TensorData. This is a stop-gap solution for integrations where consumer requires TensorType but the producer does not have it. Please use sparingly. NOTE that the static shape is not recoverable, so all dimensions in the TensorType will have the unknown shape. RAGGED tensors are not supported.- Parameters:
sparse- if the type should be sparserepresentables- primitive types of the tensor's columns- Returns:
- a TensorType corresponding to the inputs
-
fromTensorData
Creates a synthetic TensorType from a TensorData. This is a stop-gap solution for integrations where consumer requires TensorType but the producer does not have it. Please use sparingly. NOTE that the static shape is not recoverable (for dense tensors the static shape can have some of the dimensions unknown, so it is not recoverable from the dynamic shape; sparse tensors do not have even the dynamic shape), so all dimensions in the TensorType will have the unknown shape. RAGGED tensors are not supported.- Parameters:
tensorData- an instance of tensor from which to derive type information- Returns:
- a TensorType corresponding to the input
-