as_ndarray

Contents

as_ndarray#

class brainpy.math.as_ndarray(tensor, dtype=None)[source]#

Convert the input to a numpy.ndarray.

Parameters:
  • tensor (array_like) – Input data, in any form that can be converted to an array. This includes lists, lists of tuples, tuples, tuples of tuples, tuples of lists, ArrayType.

  • dtype (data-type, optional) – By default, the data-type is inferred from the input data.

Returns:

out – Array interpretation of tensor. No copy is performed if the input is already an ndarray with matching dtype.

Return type:

ndarray