Finetune and WARNING:root:NaN or Inf found in input tensor

Hello everyone!
I am trying to finetune one model (U-net architecture) for segmentation, which is trained on CityScapes, by using data from Mapillary Vistas. However, vistas have more classes then cityscapes. So, I translated classes from vistas to cityscapes classes by myself.
After that I started training and saw this warning: WARNING:root:NaN or Inf found in input tensor. I don’t understand how this appears. I hope, someone can help me :slight_smile:
Code of model I use:

Which layer is raising this issue?
Could you add a check for the input data and target and make sure that no invalid values are found via: