mindspore.numpy.empty

mindspore.numpy.empty(shape, dtype=mstype.float32)[源代码]

Returns a new array of given shape and type, without initializing entries.

说明

Numpy argument order is not supported. Object arrays are not supported.

参数
  • shape (Union[int, tuple(int)]) – Shape of the empty array, e.g., (2, 3) or 2.

  • dtype (mindspore.dtype, optional) – Desired output data-type for the array, e.g, mstype.int8. Default: mstype.float32 .

返回

Tensor, array of uninitialized (arbitrary) data of the given shape and dtype.

异常

TypeError – If the input shape or dtype is invalid.

Supported Platforms:

Ascend GPU CPU

样例

>>> import mindspore.numpy as np
>>> output = np.empty((2, 3))
>>> print(output)
[[0. 0. 0.]
 [0. 0. 0.]]