I am using a capsule networks model,  and at a certain point of the training the Relu function located in the conv layer results in nans,  using
with torch.autograd.detect_anomaly():  ,  I get this error
Traceback (most recent call last):
File “C:\Users\obouldjedr\Desktop\lastcode4\cp\test_capsnet.py”, line 532, in 
train(capsule_net, optimizer,trainloaderIMUhand, e)
File “C:\Users\obouldjedr\Desktop\lastcode4\cp\test_capsnet.py”, line 217, in train
loss.backward()
File “C:\Users\obouldjedr\Anaconda3\lib\site-packages\torch\tensor.py”, line 245, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
File “C:\Users\obouldjedr\Anaconda3\lib\site-packages\torch\autograd_init_.py”, line 145, in backward
Variable._execution_engine.run_backward(
RuntimeError: Function ‘DivBackward0’ returned nan values in its 0th output.
Does anyone knows why ? thanks