mindspore2022/docs/api/api_python/ops/mindspore.ops.BroadcastTo.rst

26 lines
918 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.BroadcastTo
==========================
.. py:class:: mindspore.ops.BroadcastTo(shape)
将输入shape广播到目标shape。如果目标shape中有-1的维度它将被该维度中的输入shape的值替换。
当输入shape广播到目标shape时它从最后一个维度开始。如果目标shape中有-1的维度则-1维度不能位于一个不存在的维度中。
**参数:**
- **shape** (tuple) - 指定广播的目标shape。
**输入:**
- **input_x** (Tensor) - BroadcastTo输入任意维度的Tensor数据类型为float16、float32、int32、int8、uint8、bool。
**输出:**
Tensor与目标 `shape` 相同,数据类型与 `input_x` 相同。
**异常:**
- **TypeError** - `shape` 不是tuple。
- **ValueError** - 目标shape和输入shape不兼容或者目标shape中的-1维度位于一个无效位置。