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

21 lines
746 B
ReStructuredText
Raw 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.ops.fill
==================
.. py:function:: mindspore.ops.fill(type, shape, value)
创建一个指定shape的Tensor并用指定值填充。
**参数:**
- **type** (mindspore.dtype) - 指定输出Tensor的数据类型。数据类型只支持 `bool_ <https://www.mindspore.cn/docs/zh-CN/master/api_python/mindspore/mindspore.dtype.html#mindspore.dtype>`_`number <https://www.mindspore.cn/docs/zh-CN/master/api_python/mindspore/mindspore.dtype.html#mindspore.dtype>`_
- **shape** (tuple[int]) - 指定输出Tensor的shape。
- **value** (Union(number.Number, bool)) - 用来填充输出Tensor的值。
**返回:**
Tensor。
**异常:**
**TypeError** - `shape` 不是元组。