Filtering rows in pytorch tensor
If i have tensor which holds information on detected images in following shape:
        [[595.00000, 179.62500, 628.00000, 283.00000,   0.89062,   0.00000],
        [142.87500, 167.62500, 201.62500, 324.00000,   0.88086,   0.00000],
        [311.75000, 170.50000, 368.75000, 320.50000,   0.87549,   0.00000],
        [555.50000, 173.75000, 593.50000, 280.50000,   0.85791,   0.00000],
        [398.50000, 179.00000, 425.50000, 265.00000,   0.84180,   0.00000],
        [445.75000, 177.75000, 479.25000, 270.75000,   0.82129,   0.00000]]

where each row represents image with following parameters :
[   top,    bottom, left,   right, confidence, class    ]

What is most effective way of dropping images (rows) that are in size smaller than some user defined input for height which is top-bottom?
Naturally I would iterate over rows and than drop each row where top-bottom &lt; someValue with some list comprehension but I suspect there could be better way of doing this.

How about I drop some benchmarks (if that would be interesting to you)?
Benchmarks
PyTorch-ic way:
In[2]: import torch
  ...: a = torch.Tensor(
  ...:      [[595.00000, 179.62500, 628.00000, 283.00000,   0.89062,   0.00000],
  ...:         [142.87500, 167.62500, 201.62500, 324.00000,   0.88086,   0.00000],
  ...:         [311.75000, 170.50000, 368.75000, 320.50000,   0.87549,   0.00000],
  ...:         [555.50000, 173.75000, 593.50000, 280.50000,   0.85791,   0.00000],
  ...:         [398.50000, 179.00000, 425.50000, 265.00000,   0.84180,   0.00000],
  ...:         [445.75000, 177.75000, 479.25000, 270.75000,   0.82129,   0.00000]])
In[3]: %timeit a[a[:, 0] - a[:, 1] &gt; 300]
Out[3]: 24.5 µs ± 904 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)

In Numpy terms:
In[4]: import numpy as np
In[5]: %timeit np_arr[np.where(np_arr[:, 0] - np_arr[:, 1] &gt; 300)]
Out[5]: 4.75 µs ± 713 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
In[6]: np_arr[np.where(np_arr[:, 0] - np_arr[:, 1] &gt; 300)]

Equity
In[7]: torch.equal(torch.from_numpy(np_arr[np.where(np_arr[:, 0] - np_arr[:, 1] &gt; 300)]), a[a[:, 0] - a[:, 1] &gt; 300])
Out[7]: True

Conclusion is that using numpy for your comparisons would be way faster than PyTorch.
