Repository: pytorch
Issue: Functionalization and fake tensors failure in torture test
Labels: triaged,module: __torch_dispatch__,module: functionalization

### 🐛 Describe the bug

```
    @patch("torchdynamo.config.verify_correctness", True)
    @patch("functorch._src.config.use_functionalize", True)
    def test_mutated_metadata(self):
        def model(x):
            y = x.view(0)
            x.resize_(20)
            x.fill_(2)
            y.fill_(3)
            return x, y

        with torchdynamo.optimize("aot_autograd"):
            for i in range(5):
                with self.subTest(i):
                    x = torch.empty(0, device="cuda:0")
                    rx, ry = model(x)
                    self.assertEqual(x, torch.full((20,), 2., device="cuda:0"))
                    self.assertEqual(rx, torch.full((20,), 2., device="cuda:0"))
                    self.assertEqual(ry, torch.empty(0, device="cuda:0"))
```

I don't think the device here matters. This fails with

```
  File "/raid/ezyang/pytorch-scratch2/torch/fx/experimental/proxy_tensor.py", line 268, in wrapped
    out = f(*tree_args)
  File "/raid/ezyang/functorch/functorch/_src/eager_transforms.py", line 1420, in wrapped
    func_outputs = func(*func_args, **func_kwargs)
  File "/raid/ezyang/functorch/functorch/_src/aot_autograd.py", line 202, in fake_fn
    return fx_g(primals, tangents)
  File "/raid/ezyang/pytorch-scratch2/torch/fx/graph_module.py", line 652, in call_wrapped
    return self._wrapped_call(self, *args, **kwargs)
  File "/raid/ezyang/pytorch-scratch2/torch/fx/graph_module.py", line 277, in __call__
    raise e
  File "/raid/ezyang/pytorch-scratch2/torch/fx/graph_module.py", line 267, in __call__
    return super(self.cls, obj).__call__(*args, **kwargs)  # type: ignore[misc]
  File "/raid/ezyang/pytorch-scratch2/torch/fx/_symbolic_trace.py", line 692, in module_call_wrapper
    return self.call_module(mod, forward, args, kwargs)
  File "/raid/ezyang/pytorch-scratch2/torch/fx/experimental/proxy_tensor.py", line 217, in call_module
    return forward(*args, **kwargs)
  File "/raid/ezyang/pytorch-scratch2/torch/fx/_symbolic_trace.py", line 685, in forward
    return _orig_module_call(mod, *args, **kwargs)
  File "/raid/ezyang/pytorch-scratch2/torch/nn/modules/module.py", line 1186, in _call_impl
    return forward_call(*input, **kwargs)
  File "<eval_with_key>.9", line 10, in forward
    fill__scalar = torch.ops.aten.fill_.Scalar(primals_1, 2);  primals_1 = None
  File "/raid/ezyang/pytorch-scratch2/torch/_ops.py", line 49, in __call__
    return self._op(*args, **kwargs or {})
  File "/raid/ezyang/pytorch-scratch2/torch/utils/_python_dispatch.py", line 74, in wrapped
    return f(self, *args, **kwargs)
  File "/raid/ezyang/pytorch-scratch2/torch/fx/experimental/proxy_tensor.py", line 326, in __torch_dispatch__
    inner_res = func_overload(*args, **kwargs)
  File "/raid/ezyang/pytorch-scratch2/torch/_ops.py", line 49, in __call__
    return self._op(*args, **kwargs or {})
  File "/raid/ezyang/pytorch-scratch2/torch/utils/_python_dispatch.py", line 74, in wrapped
    return f(self, *args, **kwargs)
  File "/raid/ezyang/pytorch-scratch2/torch/_subclasses/fake_tensor.py", line 512, in __torch_dispatch__
    raise Exception(
Exception: Invoking operators with non-Fake Tensor inputs in FakeTensorMode is not yet supported. Please convert all Tensors to FakeTensors first. Found in aten.fill_.Scalar(*(tensor(..., device='meta', size=(20,)), 2), **{})
```

cc @Chillee @ezyang @zou3519 @albanD @samdow @bdhirsh 

### Versions

master