mindspore.numpy.isscalar

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

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

说明

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.

参数

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

返回

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

异常

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

Supported Platforms:

Ascend GPU CPU

样例

>>> 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