test_batchnorm_eval_cuda_float32: AttributeError: 'NoneType' object has no attribute 'clone'
Labels: triaged

Repro:
```
PYTORCH_TEST_WITH_INDUCTOR=1 python test/test_nn.py  -k test_batchnorm_eval_cuda_float32 
```
Error:
```
/fsx/users/binbao/pytorch/torch/_dynamo/variables/builtin.py:681: UserWarning: The .grad attribute of a Tensor that is not a leaf Tensor is being accessed. Its .grad attribute won't be populated during autograd.backward(). If you indeed want the .grad field to be populated for a non-leaf Tensor, use .retain_grad() on the non-leaf Tensor. If you access the non-leaf Tensor by mistake, make sure you access the leaf Tensor instead. See github.com/pytorch/pytorch/pull/30531 for more informations. (Triggered internally at /fsx/users/binbao/pytorch/build/aten/src/ATen/core/TensorBody.h:485.)
  example_value = grapharg.example.grad
[2022-10-27 23:56:53,541] torch._dynamo.convert_frame: [ERROR] WON'T CONVERT <graph break in _test_batchnorm_eval> /fsx/users/binbao/pytorch/test/test_nn.py line 16045 
due to: 
Traceback (most recent call last):
  File "/fsx/users/binbao/pytorch/torch/_dynamo/variables/constant.py", line 61, in const_getattr
    member = getattr(self.value, name)
AttributeError: 'NoneType' object has no attribute 'clone'

from user code:
   File "/fsx/users/binbao/pytorch/test/test_nn.py", line 16046, in <graph break in _test_batchnorm_eval>
    grad1 = data.grad.clone()

Set torch._dynamo.config.verbose=True for more information
==========
/fsx/users/binbao/pytorch/test/test_nn.py:16046: UserWarning: The .grad attribute of a Tensor that is not a leaf Tensor is being accessed. Its .grad attribute won't be populated during autograd.backward(). If you indeed want the .grad field to be populated for a non-leaf Tensor, use .retain_grad() on the non-leaf Tensor. If you access the non-leaf Tensor by mistake, make sure you access the leaf Tensor instead. See github.com/pytorch/pytorch/pull/30531 for more informations. (Triggered internally at /fsx/users/binbao/pytorch/build/aten/src/ATen/core/TensorBody.h:485.)
  grad1 = data.grad.clone()
E
======================================================================
ERROR: test_batchnorm_eval_cuda_float32 (__main__.TestNNDeviceTypeCUDA)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/fsx/users/binbao/pytorch/torch/testing/_internal/common_utils.py", line 2001, in wrapper
    method(*args, **kwargs)
  File "/fsx/users/binbao/pytorch/torch/testing/_internal/common_utils.py", line 2001, in wrapper
    method(*args, **kwargs)
  File "/fsx/users/binbao/pytorch/torch/testing/_internal/common_device_type.py", line 381, in instantiated_test
    result = test(self, **param_kwargs)
  File "/fsx/users/binbao/pytorch/test/test_nn.py", line 16085, in test_batchnorm_eval
    self._test_batchnorm_eval(2, device, dtype)
  File "/fsx/users/binbao/pytorch/test/test_nn.py", line 16037, in _test_batchnorm_eval
    module = nn.BatchNorm1d(3).to(device, module_dtype)
  File "/fsx/users/binbao/pytorch/test/test_nn.py", line 16037, in <graph break in _test_batchnorm_eval>
    module = nn.BatchNorm1d(3).to(device, module_dtype)
  File "/fsx/users/binbao/pytorch/test/test_nn.py", line 16038, in <graph break in _test_batchnorm_eval>
    module.eval()
  File "/fsx/users/binbao/pytorch/test/test_nn.py", line 16045, in <graph break in _test_batchnorm_eval>
    res1.backward(grad)
  File "/fsx/users/binbao/pytorch/test/test_nn.py", line 16046, in <graph break in _test_batchnorm_eval>
    grad1 = data.grad.clone()
AttributeError: 'NoneType' object has no attribute 'clone'
```