2022-11-11 15:39:35 +08:00
|
|
|
|
mindspore.ops.zeros
|
|
|
|
|
|
====================
|
|
|
|
|
|
|
|
|
|
|
|
.. py:function:: mindspore.ops.zeros(shape, dtype=None)
|
|
|
|
|
|
|
2022-12-26 11:52:49 +08:00
|
|
|
|
创建一个填满0的Tensor,shape由 `shape` 决定, dtype由 `dtype` 决定。
|
2022-11-11 15:39:35 +08:00
|
|
|
|
|
|
|
|
|
|
参数:
|
|
|
|
|
|
- **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。
|
2022-11-11 15:39:35 +08:00
|
|
|
|
|
|
|
|
|
|
返回:
|
|
|
|
|
|
Tensor,dtype和shape由入参决定。
|
|
|
|
|
|
|
|
|
|
|
|
异常:
|
|
|
|
|
|
- **TypeError** - 如果 `shape` 既不是int也不是int的元组。
|