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

22 lines
873 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.reshape
======================
.. py:function:: mindspore.ops.reshape(input_x, input_shape)
基于给定的shape对输入Tensor进行重新排列。
`input_shape` 最多只能有一个-1在这种情况下它可以从剩余的维度和输入的元素个数中推断出来。
**参数:**
- **input_x** (Tensor) - Tensor的shape为 :math:`(x_1, x_2, ..., x_R)`
- **input_shape** (tuple[int]) - 输入tuple由多个整数构成:math:`(y_1, y_2, ..., y_S)` 。只支持常量值。
**返回:**
Tensor其shape为 :math:`(y_1, y_2, ..., y_S)`
**异常:**
- **ValueError** - 给定的 `input_shape`,如果它有多个-1或者除-1若存在之外的元素的乘积小于或等于0或者无法被输入Tensor的shape的乘积整除或者与输入的数组大小不匹配。