79693807

Date: 2025-07-08 07:15:52
Score: 0.5
Natty:
Report link

Another approach that is nice and concise:

x = torch.where(x == 2, torch.nan, x)

Or

x = torch.where(x != 2, x, torch.nan)

Copied from the question at: https://discuss.pytorch.org/t/filtered-mean-and-std-from-a-tensor/147258

Reasons:
  • Probably link only (1):
  • Low length (1):
  • Has code block (-0.5):
  • High reputation (-1):
Posted by: Chris