Array API compatible wrapper for :py:meth:`np.ndarray.T `. See its docstring for more information.
(self)
| 1120 | |
| 1121 | @property |
| 1122 | def T(self) -> Array: |
| 1123 | """ |
| 1124 | Array API compatible wrapper for :py:meth:`np.ndarray.T <numpy.ndarray.T>`. |
| 1125 | |
| 1126 | See its docstring for more information. |
| 1127 | """ |
| 1128 | # Note: T only works on 2-dimensional arrays. See the corresponding |
| 1129 | # note in the specification: |
| 1130 | # https://data-apis.org/array-api/latest/API_specification/array_object.html#t |
| 1131 | if self.ndim != 2: |
| 1132 | raise ValueError("x.T requires x to have 2 dimensions. Use x.mT to transpose stacks of matrices and permute_dims() to permute dimensions.") |
| 1133 | return self.__class__._new(self._array.T) |