Skip to content

Commit 0c5db41

Browse files
Add .mT attribute for ndarray
1 parent b737d1c commit 0c5db41

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

dpnp/dpnp_array.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ def T(self):
108108
"""View of the transposed array."""
109109
return self.transpose()
110110

111+
@property
112+
def mT(self):
113+
"""View of the matrix transposed array."""
114+
if self.ndim < 2:
115+
raise ValueError("matrix transpose with ndim < 2 is undefined")
116+
117+
return self.swapaxes(-1, -2)
118+
111119
def to_device(self, target_device):
112120
"""Transfer array to target device."""
113121

0 commit comments

Comments
 (0)