You might have skipped the problematic batch somehow?
If I add torch.autograd.set_detect_anomaly(True) in cell12:
xArray = []
iter = 0
torch.autograd.set_detect_anomaly(True)

the code will raise an exception, pointing to a detected invalid value. If I run the next cells afterwards manually, I’ll get an Inf for customLoss(X.T).