Hi,
I am new in pyTorch however, I use torch in previous.
Here is a question bother me that how to slice the tensor and keep their dims in pytorch?
In torch I could write down like that:
val = torch.rand(4,3,256,256);
val_keep = val[{{},{1},{},{}}] # output is (4x1x256x256)
val_notkeep = val[{{},1,{},{}}] # output is (4x256x256)

however, it seems python transformed the dims automaticly in pytorch?
val = torch.rand(4,3,256,256);
val_notkeep = val[:,1,:,:] #output is (4x256x256)

so how to slice the tensor and keep the dims in pytorch?