mindspore.ops.reverse ============================== .. image:: https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/r2.3.q1/resource/_static/logo_source.svg :target: https://gitee.com/mindspore/mindspore/blob/r2.3.q1/docs/api/api_python/ops/mindspore.ops.func_reverse.rst :alt: 查看源文件 .. py:function:: mindspore.ops.reverse(x, axis) 对输入Tensor按指定维度反转。 .. warning:: "axis"的取值范围为[-dims, dims - 1],"dims"表示"x"的维度长度。 参数: - **x** (Tensor) - 输入Tensor。其shape为: :math:`(N, *)` ,其中 :math:`*` 表示任意数量的附加维度。 - **axis** (Union[tuple(int), list(int)]) - 指定反转的轴。 输出: Tensor,shape和数据类型与输入 `x` 相同。 异常: - **TypeError** - `axis` 既不是list也不是tuple。 - **TypeError** - `axis` 的元素不是int。