2022-04-16 17:16:29 +08:00
|
|
|
|
mindspore.ops.fill
|
|
|
|
|
|
==================
|
|
|
|
|
|
|
|
|
|
|
|
.. py:function:: mindspore.ops.fill(type, shape, value)
|
|
|
|
|
|
|
|
|
|
|
|
创建一个指定shape的Tensor,并用指定值填充。
|
|
|
|
|
|
|
2022-07-25 15:09:45 +08:00
|
|
|
|
参数:
|
|
|
|
|
|
- **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>`_ 。
|
2022-12-28 10:06:08 +08:00
|
|
|
|
- **shape** (Union(Tensor, tuple[int])) - 指定输出Tensor的shape。
|
|
|
|
|
|
- **value** (Union(Tensor, number.Number, bool)) - 用来填充输出Tensor的值。
|
2022-04-16 17:16:29 +08:00
|
|
|
|
|
2022-07-25 15:09:45 +08:00
|
|
|
|
返回:
|
|
|
|
|
|
Tensor。
|
2022-04-16 17:16:29 +08:00
|
|
|
|
|
2022-07-25 15:09:45 +08:00
|
|
|
|
异常:
|
2022-12-28 10:06:08 +08:00
|
|
|
|
- **TypeError** - `shape` 不是元组或Tensor。
|