How can i convert a tensor like this:
tensor([[0, 1, 2, 3],
[4, 5, 6, 7]])
to this
tensor([[[0, 1],
[4, 5]],
[[2, 3],
[6, 7]]])
and vice versa.
I’ve tried view
, but a.view(2, 2, 2)
will change it to
tensor([[[0, 1],
[2, 3]],
[[4, 5],
[6, 7]]])
Thanks!