I have a tensor of shape (2,2,2,2)
:
tensor([[[[ 5., 5.],
[ 5., 5.]],
[[ 10., 10.],
[ 10., 10.]]],
[[[ 100., 100.],
[ 100., 100.]],
[[1000., 1000.],
[1000., 1000.]]]], device='cuda:0')
I want to transform it such that the tensor along axis=1 are repeated 3 times. And after applying .view(-1)
to that I get a 1D resultant tensor as:
tensor([ 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 100., 100., 100., 100., 100., 100., 100., 100., 100., 100., 100., 100., 100., 100., 100., 100., 1000., 1000., 1000., 1000. 1000., 1000., 1000., 1000. 1000., 1000., 1000., 1000. 1000., 1000., 1000., 1000.], device='cuda:0')
How to do this?