dlsyscourse / hw1

8 stars 26 forks source link

test_transpose_forward() out of index #16

Closed LukeLIN-web closed 2 months ago

LukeLIN-web commented 1 year ago
839DDE6C20F7F9DC70F1589A4923F71B 839DDE6C20F7F9DC70F1589A4923F71B
def test_transpose_forward():
    np.testing.assert_allclose(ndl.transpose(ndl.Tensor([[[1.95]],
       [[2.7 ]],
       [[3.75]]]), axes=(1, 2)).numpy(), np.array([[[1.95]],
       [[2.7 ]],
       [[3.75]]]))

It should be 0 1 2 , 3d tensor, Why it is out of index?

lantel-wm commented 8 months ago

Same error here. Did you solve it?

MatchalatteR commented 6 months ago

Same problem. Solution: from Quesiton definition the correct axes length should be the last two axes, so you just need to transpose the last two axes.

harsh1241e commented 3 months ago

Can anybody provide the for trnaspose part ?