This will probably have an effect on training as you want neither NaNs nor Infs in your code at all. What you should do is first isolate what process is causing the NaNs/Infs to be created in the input. Secondly, which inputs exactly? I’d assume this is the inputs to your discriminator?
You can locate where the NaNs are occurring by using torch.autograd.detect_anomaly the docs for this function is here → Automatic differentiation package - torch.autograd — PyTorch 1.9.0 documentation 1