Could you use this calculated value to index your tensor?
Let’s say your function computes the sum of each row:
value = x.sum(1)
x[value>threshold]

If that doesn’t work, could you post the shape of your tensor and the value you’ve calculated?