Thanks for the update. Could you add an .all() operation to the check and also check the output tensor as:
print(torch.isfinite(input).all(), torch.isfinite(target).all(), torch.isfinite(output).all())

It seems that the loss is getting a NaN value, so I guess that the model might output NaNs.