class str, dtype: DataType, shape: Optional[Tuple[int, ...]] = None)

Bases: BaseFeatureSpec

Specification of a feature in Snowflake native model packaging.

Initialize a feature.

  • name – Name of the feature.

  • dtype – Type of the elements in the feature.

  • shape

    Used to represent scalar feature, 1-d feature list, or n-d tensor. Use -1 to represent variable length. Defaults to None.


    • None: scalar

    • (2,): 1d list with a fixed length of 2.

    • (-1,): 1d list with variable length, used for ragged tensor representation.

    • (d1, d2, d3): 3d tensor.

  • SnowflakeMLException – TypeError: When the dtype input type is incorrect.

  • SnowflakeMLException – TypeError: When the shape input type is incorrect.


as_dtype() Union[dtype[Any], None, Type[Any], _SupportsDType[dtype[Any]], str, Tuple[Any, int], Tuple[Any, Union[SupportsIndex, Sequence[SupportsIndex]]], List[Any], _DTypeDict, Tuple[Any, Any]]

Convert to corresponding local Type.

as_snowpark_type() DataType

Convert to corresponding Snowpark Type.

classmethod from_dict(input_dict: Dict[str, Any]) FeatureSpec

Deserialize the feature specification from a dict.


input_dict – The dict containing information of the feature specification.


A feature specification instance deserialized and created from the dict.

classmethod from_mlflow_spec(input_spec: Union[mlflow.types.ColSpec, mlflow.types.TensorSpec], feature_name: str) FeatureSpec
to_dict() Dict[str, Any]

Serialize the feature group into a dict.


A dict that serializes the feature group.



Name of the feature.