brainpy.math.flatten#

brainpy.math.flatten(input, start_dim=None, end_dim=None)[source]#

Flattens input by reshaping it into a one-dimensional tensor. If start_dim or end_dim are passed, only dimensions starting with start_dim and ending with end_dim are flattened. The order of elements in input is unchanged.

Note

Flattening a zero-dimensional tensor will return a one-dimensional view.

Parameters:
  • input (Array) – The input array.

  • start_dim (int) – the first dim to flatten

  • end_dim (int) – the last dim to flatten

Returns:

out

Return type:

Array