MCPcopy Create free account
hub / github.com/numpy/numpy / T

Method T

numpy/array_api/_array_object.py:1122–1133  ·  view source on GitHub ↗

Array API compatible wrapper for :py:meth:`np.ndarray.T `. See its docstring for more information.

(self)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 1

_newMethod · 0.80

Tested by

no test coverage detected