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

27 lines
1.0 KiB
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.ops.Stack
====================
.. py:class:: mindspore.ops.Stack(axis=0)
在指定轴上对输入Tensor序列进行堆叠。
输入秩为 `R` 的Tensor序列则输出秩为 `(R+1)` 的Tensor。
给定输入Tensor的shape为 :math:`(x_1, x_2, ..., x_R)` 。若输入Tensor的长度为 `N` 。如果存在 :math:`axis \ge 0` 则输出Tensor的shape为 :math:`(x_1, x_2, ..., x_{axis}, N, x_{axis+1}, ..., x_R)`
**参数:**
- **axis** (int) - 指定堆叠运算的轴。取值范围为[-(R+1), R+1)。默认值0。
**输入:**
- **input_x** (Union[tuple, list]) - 输入多个Tensor对象组成的tuple或list每个Tensor具有相同shape和数据类型。
**输出:**
堆叠运算后的Tensor数据类型和 `input_x` 的相同。
**异常:**
- **TypeError** - `input_x` 中元素的数据类型不相同。
- **ValueError** - `input_x` 的长度不大于1或axis不在[-(R+1),R+1)范围中,或 `input_x` 中元素的shape不相同。