mindspore.numpy.isscalar

mindspore.numpy.isscalar(element)[源代码]

Returns True if the type of element is a scalar type.

Note

Only object types recognized by the mindspore parser are supported, which includes objects, types, methods and functions defined within the scope of mindspore. Other built-in types are not supported.

Parameters

element (any) – Input argument, can be of any type and shape.

Returns

Boolean, True if element is a scalar type, False if it is not.

Raises

TypeError – If the type of element is not supported by mindspore parser.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore.numpy as np
>>> output = np.isscalar(3.1)
>>> print(output)
True
>>> output = np.isscalar(np.array(3.1))
>>> print(output)
False
>>> output = np.isscalar(False)
>>> print(output)
True
>>> output = np.isscalar('numpy')
>>> print(output)
True