2.4K Star 8.2K Fork 4.4K

GVPMindSpore / mindspore

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
zeros_doc.yaml 1.20 KB
一键复制 编辑 原始数据 按行查看 历史
俞涵 提交于 2024-04-30 12:20 . modify format errors
zeros:
description: |
Creates a tensor filled with 0 with shape described by `size` and fills it with value 0 in type of `dtype`.
.. warning::
For argument `size`, Tensor type input will be deprecated in the future version.
Args:
size (Union[tuple[int], list[int], int, Tensor]): The specified shape of output tensor. Only positive integer or
tuple or Tensor containing positive integers are allowed. If it is a Tensor,
it must be a 0-D or 1-D Tensor with int32 or int64 dtypes.
dtype (:class:`mindspore.dtype`, optional): The specified type of output tensor. If `dtype` is ``None`` ,
mindspore.float32 will be used. Default: ``None`` .
Returns:
Tensor, whose dtype and size are defined by input.
Raises:
TypeError: If `size` is neither an int nor an tuple/list/Tensor of int.
Supported Platforms:
``Ascend`` ``GPU`` ``CPU``
Examples:
>>> import mindspore
>>> from mindspore import ops
>>> output = ops.zeros((2, 2), mindspore.float32)
>>> print(output)
[[0. 0.]
[0. 0.]]
Python
1
https://gitee.com/mindspore/mindspore.git
git@gitee.com:mindspore/mindspore.git
mindspore
mindspore
mindspore
master

搜索帮助