Repository: pytorch
Issue: Traceable tensor subclasses cannot actually be used with AOTAutograd
Labels: triaged,bug

### 🐛 Describe the bug

This patch fails:

```
diff --git a/test/dynamo/test_modules.py b/test/dynamo/test_modules.py
index 6dde69efff..4821b27e05 100644
--- a/test/dynamo/test_modules.py
+++ b/test/dynamo/test_modules.py
@@ -725,10 +725,12 @@ class NNModuleTests(torch._dynamo.test_case.TestCase):
             x = torch.randn(1).as_subclass(TensorProxy)
             cnt = torch._dynamo.testing.CompileCounter()
             out1 = foo(x)
-            opt_foo = torch._dynamo.optimize(cnt, nopython=True)(foo)
+            assert isinstance(out1, TensorProxy)
+            opt_foo = torch._dynamo.optimize("aot_eager", nopython=True)(foo)
             out2 = opt_foo(x)
+            assert isinstance(out2, TensorProxy)
 
-            self.assertEqual(cnt.op_count, 4)
+            # self.assertEqual(cnt.op_count, 4)
             self.assertTrue(torch._dynamo.testing.same(out1, out2))
 
         finally:
```

c.f.

```
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/convert_frame.py", line 339, in _convert_frame_assert
    return _compile(
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/convert_frame.py", line 395, in _compile
    out_code = transform_code_object(code, transform)
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/bytecode_transformation.py", line 341, in transform_code_object
    transformations(instructions, code_options)
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/convert_frame.py", line 382, in transform
    tracer.run()
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/symbolic_convert.py", line 1615, in run
    super().run()
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/symbolic_convert.py", line 484, in run
    and self.step()
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/symbolic_convert.py", line 454, in step
    getattr(self, inst.opname)(inst)
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/symbolic_convert.py", line 1677, in RETURN_VALUE
    self.output.compile_subgraph(self)
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/output_graph.py", line 464, in compile_subgraph
    self.compile_and_call_fx_graph(tx, pass2.graph_output_vars(), root)
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/output_graph.py", line 511, in compile_and_call_fx_graph
    compiled_fn = self.call_user_compiler(gm)
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/output_graph.py", line 551, in call_user_compiler
    raise BackendCompilerFailed(self.compiler_fn, e) from e
torch._dynamo.exc.BackendCompilerFailed: compiler_fn raised UnsupportedFakeTensorException: meta converter nyi

Set torch._dynamo.config.verbose=True for more information
```

The root cause of the problem is that torch function should be eliminated from inputs to the compiler, but we just directly pass in the tensor subclass as is. But even if we eliminated it as input from the compiler, we also have to eliminate it from the runtime input to the compiled function, AND we need to reconstruct the subclasses from the output.

Eager accidentally works because the tests are too trivial, and the inner traced function is identical to the outer function calls, so we end up just doing the conventional torch function path.

### Error logs

_No response_

### Minified repro

_No response_