I have a model that responds with a tensor object and I want to filter it so that I can get a new tensor.
My goal is to filter by the 6th argument so that I can get only the values that are zero (0).
How would I do this efficiently?
I have an example of such an object. I don’t want to create a new object every time because it takes a while to create it as a cuda tensor.
import torch myobj = torch.tensor([ [8.32500e+02, 1.72969e+02, 9.27000e+02, 3.81375e+02, 6.51855e-01, 0.00000e+01], [5.01750e+02, 1.21500e+02, 8.13000e+02, 3.91875e+02, 2.75879e-01, 6.10000e+01], [7.90500e+02, 2.60625e+02, 8.53500e+02, 3.55875e+02, 2.71729e-01, 0.00000e+01], [0.00000e+00, 2.12812e+01, 1.26562e+02, 3.68250e+02, 2.68066e-01, 7.20000e+01] ]) myobj = myobj.to('cuda')