Printing values of one dimension of a tensor

Hi everyone,

I’m kinda new to python and pytorch, so I was wondering how I can print only one dimension of a tensor. I have a (1,2,388,388) and I’d like to see the values of the second dimension, how can I do that?

Thank you,

You could just slice the tensor in this dimension:

x = torch.randn(1, 2, 388, 388)
print(x[:, 1])

Thank you so much, I was confused