mindspore/docs/api/api_python/numpy/mindspore.numpy.zeros_like.rst

20 lines
904 B
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.numpy.zeros_like
=================================
.. py:function:: mindspore.numpy.zeros_like(a, dtype=None, shape=None)
返回一个与给定数组 ``a`` 具有相同shape和类型的Tensor其中所有元素用0来填充。
.. note::
输入数组在同一维度上必须具有相同的size。如果 ``a`` 不是Tensor且未设置 ``dtype`` ,那么默认情况下 ``dtype`` 是float32。
参数:
- **a** (Union[Tensor, list, tuple]) - 原数组返回数组的shape和数据类型与 ``a`` 相同。
- **dtype** (mindspore.dtype, 可选) - 覆盖结果的数据类型。
- **shape** (int, ints的序列, 可选) - 覆盖结果的shape。
返回:
Tensor与给定 ``a`` 的shape和数据类型相同其中所有元素都为0。
异常:
- **ValueError** - 如果 ``a`` 不是Tensor、List或Tuple。