Hi smth!



 smth:

but comparing anything to nan is futile, and maybe the max remains to be -inf


Pytorch’s min() and max() appear to “do the right thing” with nan:
>>> import torch
>>> torch.__version__
'1.9.0'
>>> tnan = torch.tensor ([float ('nan')])
>>> tinf = torch.tensor ([float ('inf')])
>>> torch.min (tinf, tnan)
tensor([nan])
>>> torch.max (tinf, tnan)
tensor([nan])

Also, MaxPool2d appears to work as “expected”:
>>> maxp = torch.nn.MaxPool2d (3)
>>> t = torch.randn (1, 1, 10, 10)
>>> t[0, 0, 4, 4] = tnan
>>> maxp (t)
tensor([[[[1.1035, 1.3305, 3.2121],
          [2.3521,    nan, 1.2039],
          [0.7372, 0.4652, 2.2204]]]])

Best.
K. Frank