RuntimeError: Function 'ExpBackward' returned nan values in its 0th output.

MeanAct = lambda x: torch.clamp(torch.exp(x), 1e-5, 1e6)

Traceback (most recent call last):
loss.backward()
torch.autograd.backward(self, gradient, retain_graph, create_graph)
RuntimeError: Function ‘ExpBackward’ returned nan values in its 0th output.

I used the function MeanAct as the last activation function and the backward, An error has occurred. as seen in above

Hi,

Can you share a small code sample we can use to reproduce the error please? This looks surprising indeed.

Probably unrelated, but just for the sake of completeness:
we had apparently an issue in 1.4 for pow in this thread.

@yuansongzeng which PyTorch version are you using?

1 Like