Get this error: WARNING:root:NaN or Inf found in input tensor

I am trying to run alexnet on cifar-10 and i get this warning and after that the loss values are NaN:

WARNING:root:NaN or Inf found in input tensor.

I check my input with the following command and it does not show if there is an inf or nan in the input:

        assert torch.sum(torch.isnan(input)).item() == 0
        assert torch.sum(torch.isinf(input)).item() == 0

What can be wrong?

All feature maps are also not nan and inf?