I have the following snippet, I’m wondering how to effectively vectorize this in ‘pure’ pytorch:
indices = []
for i in range(0, self.dataset.shape[0]):
    if torch.mean(self.dataset[i]) >= .2:
        indices.append(i)

self.dataset = self.dataset[indices, :, :, :, :]
self.target = self.target[indices, :, :, :, :]

I tried
b = torch.mean(self.dataset, dim=0) > .2
indices = b.nonzero()
and
torch.where(torch.mean(self.dataset[:, ???]) > .2, self.dataset, torch.FloatTensor([0.0]))
to no avail. Any thoughts?