本文简要介绍 python 语言中  numpy.transpose  的用法。
- 用法:- numpy.transpose(a, axes=None)
- 反转或置换数组的轴;返回修改后的数组。 - 对于具有两个轴的数组 a,transpose(a) 给出矩阵转置。 - 有关完整文档,请参阅 - numpy.ndarray.transpose。- a: array_like
- 输入数组。 
- axes: 元组或整数列表,可选
- 如果指定,它必须是包含 [0,1,..,N-1] 排列的元组或列表,其中 N 是 a 的轴数。返回数组的第 i 个轴将对应于输入的编号为 - axes[i]的轴。如果未指定,则默认为- range(a.ndim)[::-1],这会反转轴的顺序。
 
- p: ndarray
- a 其轴已置换。尽可能返回视图。 
 
 - 参数:- 返回:- 注意:- 使用轴关键字参数时,使用 transpose(a, argsort(axes)) 反转张量的转置。 - 转置一维数组会返回原始数组的未更改视图。 - 例子:- >>> x = np.arange(4).reshape((2,2)) >>> x array([[0, 1], [2, 3]])- >>> np.transpose(x) array([[0, 2], [1, 3]])- >>> x = np.ones((1, 2, 3)) >>> np.transpose(x, (1, 0, 2)).shape (2, 1, 3)- >>> x = np.ones((2, 3, 4, 5)) >>> np.transpose(x).shape (5, 4, 3, 2)
相关用法
- Python numpy trace用法及代码示例
- Python numpy trapz用法及代码示例
- Python numpy trim_zeros用法及代码示例
- Python numpy tri用法及代码示例
- Python numpy true_divide用法及代码示例
- Python numpy triu_indices用法及代码示例
- Python numpy triu用法及代码示例
- Python numpy tril用法及代码示例
- Python numpy tril_indices用法及代码示例
- Python numpy trunc用法及代码示例
- Python numpy testing.rundocs用法及代码示例
- Python numpy testing.assert_warns用法及代码示例
- Python numpy testing.assert_array_almost_equal_nulp用法及代码示例
- Python numpy testing.assert_array_less用法及代码示例
- Python numpy testing.assert_raises用法及代码示例
- Python numpy testing.assert_almost_equal用法及代码示例
- Python numpy tile用法及代码示例
- Python numpy testing.assert_approx_equal用法及代码示例
- Python numpy tanh用法及代码示例
- Python numpy testing.assert_allclose用法及代码示例
- Python numpy testing.decorators.slow用法及代码示例
- Python numpy testing.suppress_warnings用法及代码示例
- Python numpy take用法及代码示例
- Python numpy testing.assert_string_equal用法及代码示例
- Python numpy testing.run_module_suite用法及代码示例
注:本文由纯净天空筛选整理自numpy.org大神的英文原创作品 numpy.transpose。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
