mindspore.ops.Zeros
- class mindspore.ops.Zeros[source]
Zeros will be deprecated in the future. Please use class mindspore.ops.zeros instead.
Creates a tensor filled with value zeros.
Creates a tensor with shape described by the first argument and fills it with value zeros in type of the second argument.
Warning
For argument size, Tensor type input will be deprecated in the future version.
- Inputs:
shape (tuple[int], List[int], int, Tensor) - The specified shape of output tensor.
type (mindspore.dtype) - The specified type of output tensor.
- Outputs:
Tensor, whose dtype and size are defined by input.
- Raises
TypeError – If shape is neither an int nor a tuple/list/Tensor of int.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> from mindspore import ops >>> zeros = ops.Zeros() >>> output = zeros((2, 2), mindspore.float32) >>> print(output) [[0. 0.] [0. 0.]]