mindspore/docs/api/api_python/ops/mindspore.ops.func_zeros.rst

17 lines
628 B
ReStructuredText
Raw Normal View History

mindspore.ops.zeros
====================
.. py:function:: mindspore.ops.zeros(shape, dtype=None)
2022-12-26 11:52:49 +08:00
创建一个填满0的Tensorshape由 `shape` 决定, dtype由 `dtype` 决定。
参数:
- **shape** (Union[tuple[int], int]) - 用来描述所创建的Tensor的 `shape`
2022-12-13 14:00:11 +08:00
- **dtype** (:class:`mindspore.dtype`, 可选) - 用来描述所创建的Tensor的 `dtype`。如果为None那么将会使用mindspore.float32。默认值None。
返回:
Tensordtype和shape由入参决定。
异常:
- **TypeError** - 如果 `shape` 既不是int也不是int的元组。