cf.Variable.transpose

Variable.transpose(axes=None, i=False)[source]

Permute the dimensions of the data array.

Parameters :
axes : (sequence of) int

The new axis order of the data array. By default the order is reversed. Each axis of the new order is identified by its original integer position.

i : bool, optional

Returns :

out : cf.Variable

See also

expand_dims, flip, squeeze

Examples

>>> f.shape
(2, 3, 4)
>>> f.transpose()
>>> f.shape
(4, 3, 2)
>>> f.transpose([1, 2, 0])
>>> f.shape
(3, 2, 4)
>>> f.transpose((1, 0, 2))
>>> f.shape
(2, 3, 4)

Previous topic

cf.Variable.squeeze

Next topic

Constants of the cf module

This Page