mindspore.ops.Zeros

View Source On Gitee
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.

Inputs:
  • shape (Union[tuple[int], int]) - The specified shape of output tensor.

  • type (mindspore.dtype) - The specified type of output tensor.

Outputs:

Tensor, has the same type and shape as input shape value.

Raises
  • TypeError – If shape is neither int nor tuple.

  • TypeError – If shape is a tuple whose elements are not all int.

Supported Platforms:

Deprecated

Examples

>>> import mindspore
>>> from mindspore import ops
>>> zeros = ops.Zeros()
>>> output = zeros((2, 2), mindspore.float32)
>>> print(output)
[[0. 0.]
 [0. 0.]]