mindspore.numpy.empty
- mindspore.numpy.empty(shape, dtype=mstype.float32)[source]
Returns a new array of given shape and type, without initializing entries.
Note
Numpy argument order is not supported. Object arrays are not supported.
- Parameters
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 is mstype.float32.
- Returns
Tensor, array of uninitialized (arbitrary) data of the given shape and dtype.
- Raises
TypeError – if the input shape or dtype is invalid.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore.numpy as np >>> output = np.empty((2, 3)) >>> print(output) # result may vary Tensor(shape=[2, 3], dtype=Float32, value= <uninitialized>)