transpose

Contents

transpose#

class brainunit.math.transpose(a, axes=None, **kwargs)#

Permute the dimensions of a quantity or an array.

Parameters:
  • a (Array | saiunit.Quantity) – Input array.

  • axes (int | Tuple[int, ...] | None) – By default, reverse the dimensions, otherwise permute the axes according to the values given.

Returns:

pa with its axes permuted. A view is returned whenever possible.

Return type:

Array | saiunit.Quantity

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> a = jnp.ones((2, 3)) * u.second
>>> u.math.transpose(a).shape
(3, 2)