dsplit

Contents

dsplit#

class brainunit.math.dsplit(a, indices_or_sections, **kwargs)#

Split a quantity or an array into multiple sub-arrays along the 3rd axis (depth).

Parameters:
  • a (Array | saiunit.Quantity) – Array to be divided into sub-arrays.

  • indices_or_sections (int | Sequence[int]) – If indices_or_sections is an integer, N, the array will be divided into N equal arrays along the third axis (depth). If such a split is not possible, an error is raised. If indices_or_sections is a 1-D array of sorted integers, the entries indicate where along the third axis the array is split.

Returns:

res – A list of sub-arrays.

Return type:

Sequence[saiunit.Quantity | Array]

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> a = jnp.arange(16.0).reshape(2, 2, 4) * u.meter
>>> u.math.dsplit(a, 2)