[BE] Add friendly error message if you compile_fx_inner but not return tuple/list (#113451)

Previously it would fail here:

```
  File "/data/users/ezyang/a/pytorch/torch/_inductor/fx_passes/post_grad.py", line 597, in remove_noop_ops
    for out in tuple(graph.nodes)[-1].args[0]:
```

Now you'll trigger this assert instead.

Signed-off-by: Edward Z. Yang <ezyang@meta.com>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/113451
Approved by: https://github.com/albanD
diff --git a/torch/_inductor/compile_fx.py b/torch/_inductor/compile_fx.py
index c1dd804..e2bf92d 100644
--- a/torch/_inductor/compile_fx.py
+++ b/torch/_inductor/compile_fx.py
@@ -345,6 +345,10 @@
     if dynamo_utils.count_calls(gm.graph) == 0 and not aot_mode:
         return make_boxed_func(gm.forward)
 
+    assert isinstance(
+        next(iter(reversed(gm.graph.nodes))).args[0], (tuple, list)
+    ), f"inductor can only compile FX graphs which return a tuple/list, but got {gm.graph}"
+
     if config.save_args:
         save_args_for_compile_fx_inner(
             gm,