def METHOD_NAME(self):
    params = make_params(5, num_dims=[1])
    params[2].grad[-1] = float('NaN')
    self.assertRaises(
        RuntimeError, clip_grad_norm_, params, 1.0, error_if_nonfinite=True)