mindspore/docs/api/api_python/ops/mindspore.ops.func_swapdims...

20 lines
646 B
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.swapdims
=======================
.. py:function:: mindspore.ops.swapdims(x, dim0, dim1)
交换Tensor的两个维度。
该函数和 :func:`mindspore.ops.swapaxes` 功能一致。
参数:
- **x** (Tensor) - 输入Tensor。
- **dim0** (int) - 第一个维度。
- **dim1** (int) - 第二个维度。
返回:
转化后的Tensor与输入具有相同的数据类型。
异常:
- **TypeError** - `x` 不是Tensor类型。
- **TypeError** - `dim0``dim1` 不是整数。
- **ValueError** - `dim0``dim1` 不在 `[-ndim, ndim-1]` 范围内。