brainpy.math.trace#

brainpy.math.trace(a, offset=0, axis1=0, axis2=1, dtype=None, out=None)#

Similar to jax.numpy.trace function, while it is compatible with brainpy Array/Variable.

Note that this function is also compatible with:

  1. NumPy or PyTorch syntax when receiving out argument.

  2. PyTorch syntax when receiving keepdim or dim argument.

  3. TensorFlow syntax when receiving keep_dims argument.