Class TensorTypes

java.lang.Object
com.linkedin.feathr.common.tensor.TensorTypes

public final class TensorTypes extends Object
Utility functions for working with TensorType
  • Method Details

    • parseTensorType

      public static TensorType parseTensorType(String syntax)
      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

      public static TensorType fromRepresentables(boolean sparse, Representable[] representables)
      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 sparse
      representables - primitive types of the tensor's columns
      Returns:
      a TensorType corresponding to the inputs
    • fromTensorData

      public static TensorType fromTensorData(TensorData tensorData)
      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