MalumaDev:

x = x.reshape(1,1,2,8)


Thanks for your reply.
Your code generates following tensor that is not what I want:
tensor([[[[ 1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.],
          [ 9., 10., 11., 12., 13., 14., 15., 16.]]]])