pub struct VariableShapeTensor {
    value_type: DataType,
    dimensions: usize,
    metadata: VariableShapeTensorMetadata,
}Expand description
The extension type for VariableShapeTensor.
Extension name: arrow.variable_shape_tensor.
The storage type of the extension is: StructArray where struct is composed of data and shape fields describing a single tensor per row:
- datais a List holding tensor elements (each list element is a single tensor). The List’s value type is the value type of the tensor, such as an integer or floating-point type.
- shapeis a- FixedSizeList<int32>[ndim]of the tensor shape where the size of the list- ndimis equal to the number of dimensions of the tensor.
Extension type parameters:
value_type: the Arrow data type of individual tensor elements.
Optional parameters describing the logical layout:
- dim_names: explicit names to tensor dimensions as an array. The length of it should be equal to the shape length and equal to the number of dimensions.- dim_namescan be used if the dimensions have well-known names and they map to the physical layout (row-major).
- permutation: indices of the desired ordering of the original dimensions, defined as an array. The indices contain a permutation of the values- [0, 1, .., N-1]where- Nis the number of dimensions. The permutation indicates which dimension of the logical layout corresponds to which dimension of the physical tensor (the i-th dimension of the logical view corresponds to the dimension with number- permutations[i]of the physical tensor). Permutation can be useful in case the logical order of the tensor is a permutation of the physical order (row-major). When logical and physical layout are equal, the permutation will always be (- [0, 1, .., N-1]) and can therefore be left out.
- uniform_shape: sizes of individual tensor’s dimensions which are guaranteed to stay constant in uniform dimensions and can vary in non- uniform dimensions. This holds over all tensors in the array. Sizes in uniform dimensions are represented with int32 values, while sizes of the non-uniform dimensions are not known in advance and are represented with null. If- uniform_shapeis not provided it is assumed that all dimensions are non-uniform. An array containing a tensor with shape (2, 3, 4) and whose first and last dimensions are uniform would have- uniform_shape(2, null, 4). This allows for interpreting the tensor correctly without accounting for uniform dimensions while still permitting optional optimizations that take advantage of the uniformity.
https://arrow.apache.org/docs/format/CanonicalExtensions.html#variable-shape-tensor
Fields§
§value_type: DataTypeThe data type of individual tensor elements.
dimensions: usizeThe number of dimensions of the tensor.
metadata: VariableShapeTensorMetadataThe metadata of this extension type.
Implementations§
Source§impl VariableShapeTensor
 
impl VariableShapeTensor
Sourcepub fn try_new(
    value_type: DataType,
    dimensions: usize,
    dimension_names: Option<Vec<String>>,
    permutations: Option<Vec<usize>>,
    uniform_shapes: Option<Vec<Option<i32>>>,
) -> Result<Self, ArrowError>
 
pub fn try_new( value_type: DataType, dimensions: usize, dimension_names: Option<Vec<String>>, permutations: Option<Vec<usize>>, uniform_shapes: Option<Vec<Option<i32>>>, ) -> Result<Self, ArrowError>
Returns a new variable shape tensor extension type.
§Error
Return an error if the provided dimension names, permutations or uniform shapes are invalid.
Sourcepub fn value_type(&self) -> &DataType
 
pub fn value_type(&self) -> &DataType
Returns the value type of the individual tensor elements.
Sourcepub fn dimensions(&self) -> usize
 
pub fn dimensions(&self) -> usize
Returns the number of dimensions in this variable shape tensor.
Sourcepub fn dimension_names(&self) -> Option<&[String]>
 
pub fn dimension_names(&self) -> Option<&[String]>
Returns the names of the dimensions in this variable shape tensor, if set.
Sourcepub fn permutations(&self) -> Option<&[usize]>
 
pub fn permutations(&self) -> Option<&[usize]>
Returns the indices of the desired ordering of the original dimensions, if set.
Sourcepub fn uniform_shapes(&self) -> Option<&[Option<i32>]>
 
pub fn uniform_shapes(&self) -> Option<&[Option<i32>]>
Returns sizes of individual tensor’s dimensions which are guaranteed to stay constant in uniform dimensions and can vary in non-uniform dimensions.
Trait Implementations§
Source§impl Clone for VariableShapeTensor
 
impl Clone for VariableShapeTensor
Source§fn clone(&self) -> VariableShapeTensor
 
fn clone(&self) -> VariableShapeTensor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VariableShapeTensor
 
impl Debug for VariableShapeTensor
Source§impl ExtensionType for VariableShapeTensor
 
impl ExtensionType for VariableShapeTensor
Source§const NAME: &'static str = "arrow.variable_shape_tensor"
 
const NAME: &'static str = "arrow.variable_shape_tensor"
Source§type Metadata = VariableShapeTensorMetadata
 
type Metadata = VariableShapeTensorMetadata
Source§fn metadata(&self) -> &Self::Metadata
 
fn metadata(&self) -> &Self::Metadata
&() if
if this extension type defines no metadata (Self::Metadata=()).Source§fn serialize_metadata(&self) -> Option<String>
 
fn serialize_metadata(&self) -> Option<String>
None if this extension type defines no metadata
(Self::Metadata=()). Read moreSource§fn deserialize_metadata(
    metadata: Option<&str>,
) -> Result<Self::Metadata, ArrowError>
 
fn deserialize_metadata( metadata: Option<&str>, ) -> Result<Self::Metadata, ArrowError>
None for the serialized metadata and return
Ok(()). Read moreSource§fn supports_data_type(&self, data_type: &DataType) -> Result<(), ArrowError>
 
fn supports_data_type(&self, data_type: &DataType) -> Result<(), ArrowError>
Ok(()) iff the given data type is supported by this extension
type.