Sorry,
The fnt I consider in the example is simple and you’re right in the philosophy.
But it remains that the c != None cannot apply. c is a torch.tensor of shape (N,1) where N is the batch size.
a= torch.Size([100, 1])
 if a != None:
    print(a)
 else:
    print('nok')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: ne() received an invalid combination of arguments - got (NoneType), but expected one of:
 * (Tensor other)
      didn't match because some of the arguments have invalid types: (NoneType)
 * (Number other)
      didn't match because some of the arguments have invalid types: (NoneType)