Visualization of a multidimensional tensor

Hello,

I’m looking for ways to visualize a multidimensional tensor. In my example the tensor is of size: torch.Size([32, 32, 4, 4])

I would be happy with any kind of help!

Since you’ve not specified which dimensions you want to visualize, I’m assuming your data is in the format of (B x C x H x W). Then you can just use,

torchvision.utils.make_grid(tensor)

which will expand your tensor in B and C to give you a tensor of ((BxC) x H x W) which you can then convert to numpy array and view.

For more information, you can refer to:
https://pytorch.org/docs/stable/torchvision/utils.html#torchvision-utils

1 Like