Hey,
Im curious as to if there is a performance difference between these two:
mask = ...
target = ...
pred = ...
loss = torch.sum(mask * (target - pred) ** 2)
loss.backward()

and
mask = ...
target = ...
pred = ...
loss = torch.sum((target[mask] - pred[mask]) ** 2)
loss.backward()

Code would mostly be running on GPU.