Non-finite value is introduced somewhere later.
Following gives the same error; Inf values are not considered anomalous for some reason…
with torch.autograd.set_detect_anomaly(True):
torch.ones(1).requires_grad_().clamp(0.01, 0.99).div(0).backward()