cf.Data.expand_dims

Data.expand_dims(position=0, axis=None, direction=True)[source]

Expand the shape of the data array in place.

Insert a new size 1 axis, corresponding to a given position in the data array shape.

Not to be confused with the expand_partition_dims method.

Parameters :
position : int, optional

Position (amongst axes) where new axis is to be inserted. By default, insert at position 0.

axis : str, optional

direction : bool, optional

Returns :

None

See also

flip, squeeze, transpose

Examples

>>> d.expand_dims(1)
>>> d.expand_dims(2, direction=True)
>>> d.expand_dims(-1, axis='dim3')
>>> d.expand_dims(0, direction=False, axis=None)

Previous topic

cf.Data.equivalent

Next topic

cf.Data.expand_partition_dims

This Page