classmethod DataType.tensor(dtype: daft.datatype.DataType, shape: Optional[tuple[int, ...]] = None) daft.datatype.DataType[source]#

Create a tensor DataType: tensor arrays contain n-dimensional arrays of data of the provided dtype as elements, each of the provided shape.

If a shape is given, each ndarray in the column will have this shape.

If shape is not given, the ndarrays in the column can have different shapes. This is much more flexible, but will result in a less compact representation and may be make some operations less efficient.

  • dtype – The type of the data contained within the tensor elements.

  • shape – The shape of each tensor in the column. This is None by default, which allows the shapes of each tensor element to vary.