ray.data.extensions.tensor_extension.ArrowVariableShapedTensorType#

class ray.data.extensions.tensor_extension.ArrowVariableShapedTensorType(dtype: pyarrow.lib.DataType, ndim: int)[source]#

Bases: pyarrow.lib.PyExtensionType

Arrow ExtensionType for an array of heterogeneous-shaped, homogeneous-typed tensors.

This is the Arrow side of TensorDtype for tensor elements with different shapes. Note that this extension only supports non-ragged tensor elements; i.e., when considering each tensor element in isolation, they must have a well-defined, non-ragged shape.

See Arrow extension type docs: https://arrow.apache.org/docs/python/extending_types.html#defining-extension-types-user-defined-types

PublicAPI (alpha): This API is in alpha and may change before becoming stable.

to_pandas_dtype()[source]#

Convert Arrow extension type to corresponding Pandas dtype.

Returns

An instance of pd.api.extensions.ExtensionDtype.

property ndim: int#

Return the number of dimensions in the tensor elements.

property scalar_type#

Returns the type of the underlying tensor elements.