提交 81b6a733 编写于 作者: M Megvii Engine Team

fix(mge): fix bug of tensor.T

GitOrigin-RevId: 9fe9347b006dc894aaad8e22ba60d3f00c2216aa
上级 fc4c9292
......@@ -371,7 +371,7 @@ class ArrayMethodMixin(abc.ABC):
def transpose(self, *args):
if not args:
args = reversed(range(self.ndim))
args = range(self.ndim)[::-1]
return _transpose(self, _expand_args(args))
def flatten(self):
......
......@@ -60,3 +60,9 @@ def test_computing_with_numpy_array():
np.testing.assert_equal(np.add(xx, y).numpy(), np.add(x, y))
np.testing.assert_equal(np.equal(xx, y).numpy(), np.equal(x, y))
np.testing.assert_equal(np.equal(xx, xx).numpy(), np.equal(x, x))
def test_transpose():
x = np.random.rand(2, 5).astype("float32")
xx = TensorWrapper(x)
np.testing.assert_almost_equal(xx.T.numpy(), x.T)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册