I have a 3-D tensor of shape (10, 15, 20). I want to reduce it to be a 2-D tensor with shape (10, 15), making sure that I select only a random element from the original 3-D tensor’s third dimension (of length 20).
I have tried index notation by generating an index tensor that matches the third dimension, but am running into dimensional broadcasting issues.
Thank you for your input @thecho7 - much appreciated.
The problem still persists for me.
tensor.squeeze() only works for removing dimensions of size 1. I am ending with a dimension (10, 15, 20), which remains unaltered by the squeeze operation.