test_LSTM_grad_and_gradgrad_cuda_float64: ValueError: gradcheck expects at least one input tensor to require gradient, but none of the them have requires_grad=True.
Labels: triaged

Repro:
```
PYTORCH_TEST_WITH_INDUCTOR=1 python test/test_nn.py -k  test_LSTM_grad_and_gradgrad_cuda_float64
```
Error (uupdated):
```
/scratch/binbao/work/pytorch/torch/_dynamo/eval_frame.py:361: UserWarning: TensorFloat32 tensor cores for float32 matrix multiplication available but not enabled.Consider setting `torch.set_float32_matmul_precision('high')`
  warnings.warn(
[2022-11-30 21:19:34,297] torch._dynamo.convert_frame: [ERROR] WON'T CONVERT <graph break in _test_rnn_mod> /scratch/binbao/work/pytorch/test/test_nn.py line 9981 
due to: 
Traceback (most recent call last):
  File "/scratch/binbao/work/pytorch/torch/_dynamo/variables/builder.py", line 815, in wrap_fx_proxy_cls
    raise AssertionError(
AssertionError: torch.* op returned non-Tensor _GeneratorContextManager call_function <function flags at 0x7f758f923430>

from user code:
   File "/scratch/binbao/work/pytorch/test/test_nn.py", line 9982, in <graph break in _test_rnn_mod>
    with torch.backends.cudnn.flags(enabled=False):

Set torch._dynamo.config.verbose=True for more information


/scratch/binbao/work/pytorch/torch/storage.py:315: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.
  warnings.warn(message, UserWarning)
[2022-11-30 21:19:35,546] torch._inductor.ir: [WARNING] Using FallbackKernel: aten._thnn_fused_lstm_cell
[2022-11-30 21:19:37,051] torch._inductor.graph: [WARNING] Creating implicit fallback for:
  target: aten._thnn_fused_lstm_cell_backward_impl.default
  args[0]: TensorBox(StorageBox(
    Pointwise(
      'cuda',
      torch.float64,
      load(tangents_2, i1 + 4 * i0) + load(tangents_1, i1 + 4 * i0),
      ranges=[3, 4],
      origins={select, tangents_1, tangents_2, select_2, add}
    )
  ))
  args[1]: TensorBox(
    ReinterpretView(
      StorageBox(
        InputBuffer(name='tangents_3', layout=FixedLayout('cuda', torch.float64, size=[1, 3, 4], stride=[12, 4, 1]))
      ),
      FixedLayout('cuda', torch.float64, size=[3, 4], stride=[4, 1]),
      no origins?
    )
  )
  args[2]: TensorBox(StorageBox(
    InputBuffer(name='getitem', layout=FixedLayout('cuda', torch.float64, size=[3, 4], stride=[4, 1]))
  ))
  args[3]: TensorBox(StorageBox(
    InputBuffer(name='getitem_4', layout=FixedLayout('cuda', torch.float64, size=[3, 4], stride=[4, 1]))
  ))
  args[4]: TensorBox(StorageBox(
    InputBuffer(name='getitem_5', layout=FixedLayout('cuda', torch.float64, size=[3, 16], stride=[16, 1]))
  ))
  args[5]: True
[2022-11-30 21:19:37,064] torch._inductor.ir: [WARNING] Using FallbackKernel: torch.ops.aten._thnn_fused_lstm_cell_backward_impl.default
/scratch/binbao/work/pytorch/torch/autograd/gradcheck.py:950: UserWarning: Backwards compatibility: New undefined gradient support checking feature is enabled by default, but it may break existing callers of this function. If this is true for you, you can call this function with "check_undefined_grad=False" to disable the feature
  warnings.warn((
E
======================================================================
ERROR: test_LSTM_grad_and_gradgrad_cuda_float64 (__main__.TestNNDeviceTypeCUDA)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/scratch/binbao/work/pytorch/torch/autograd/gradcheck.py", line 959, in check_undefined_grad_support
    grads_input = torch.autograd.grad(output_to_check, diff_input_list,
  File "/scratch/binbao/work/pytorch/torch/autograd/__init__.py", line 300, in grad
    return Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
  File "/scratch/binbao/work/pytorch/torch/autograd/function.py", line 270, in apply
    return user_fn(self, *args)
  File "/scratch/binbao/work/pytorch/functorch/_src/aot_autograd.py", line 1385, in backward
    all_args = list(ctx.symints) + list(ctx.saved_tensors) + list(contiguous_args)
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.DoubleTensor [3, 4]] is at version 7; expected version 4 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/scratch/binbao/work/pytorch/torch/testing/_internal/common_utils.py", line 2053, in wrapper
    method(*args, **kwargs)
  File "/scratch/binbao/work/pytorch/torch/testing/_internal/common_device_type.py", line 391, in instantiated_test
    raise rte
  File "/scratch/binbao/work/pytorch/torch/testing/_internal/common_device_type.py", line 378, in instantiated_test
    result = test(self, **param_kwargs)
  File "/scratch/binbao/work/pytorch/torch/testing/_internal/common_device_type.py", line 866, in dep_fn
    return fn(slf, *args, **kwargs)
  File "/scratch/binbao/work/pytorch/test/test_nn.py", line 10012, in test_LSTM_grad_and_gradgrad
    self._test_rnn_mod(mod, inp)
  File "/scratch/binbao/work/pytorch/test/test_nn.py", line 9981, in _test_rnn_mod
    gradcheckfunc = partial(flatten_out, mod)
  File "/scratch/binbao/work/pytorch/test/test_nn.py", line 9983, in <graph break in _test_rnn_mod>
    gradcheck(gradcheckfunc, inp, check_batched_grad=False)
  File "/scratch/binbao/work/pytorch/torch/testing/_internal/common_utils.py", line 3716, in gradcheck
    return torch.autograd.gradcheck(fn, inputs, **kwargs)
  File "/scratch/binbao/work/pytorch/torch/autograd/gradcheck.py", line 1418, in gradcheck
    return _gradcheck_helper(**args)
  File "/scratch/binbao/work/pytorch/torch/autograd/gradcheck.py", line 1451, in _gradcheck_helper
    _test_undefined_backward_mode(func, outputs, tupled_inputs)
  File "/scratch/binbao/work/pytorch/torch/autograd/gradcheck.py", line 992, in _test_undefined_backward_mode
    return all(check_undefined_grad_support(output) for output in outputs_to_check)
  File "/scratch/binbao/work/pytorch/torch/autograd/gradcheck.py", line 992, in <genexpr>
    return all(check_undefined_grad_support(output) for output in outputs_to_check)
  File "/scratch/binbao/work/pytorch/torch/autograd/gradcheck.py", line 963, in check_undefined_grad_support
    raise GradcheckError((
torch.autograd.gradcheck.GradcheckError: Expected backward function to handle undefined output grads. Please look at "Notes about undefined output gradients" in "tools/autograd/derivatives.yaml"
```