Repository: pytorch
Issue: [torch.compile] `torch.compile` throws an error when nn.Module contains a dataclass with float values.
Labels: triaged,oncall: pt2,module: dynamo

### 🐛 Describe the bug

I think `torch.compile` somehow treats scalar values as `tensors` but i don't see how scalar values should be a problem in this case.

This helps but falls back to eager mode
```
torch._dynamo.config.suppress_errors = True
```

What is the best way to debug this?

```
Traceback (most recent call last):
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 1446, in _call_user_compiler
    compiled_fn = compiler_fn(gm, self.example_inputs())
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_dynamo/repro/after_dynamo.py", line 129, in __call__
    compiled_gm = compiler_fn(gm, example_inputs)
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/__init__.py", line 2235, in __call__
    return compile_fx(model_, inputs_, config_patches=self.config)
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1521, in compile_fx
    return aot_autograd(
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_dynamo/backends/common.py", line 72, in __call__
    cg = aot_module_simplified(gm, example_inputs, **self.kwargs)
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 1071, in aot_module_simplified
    compiled_fn = dispatch_and_compile()
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 1056, in dispatch_and_compile
    compiled_fn, _ = create_aot_dispatcher_function(
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 522, in create_aot_dispatcher_function
    return _create_aot_dispatcher_function(
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 759, in _create_aot_dispatcher_function
    compiled_fn, fw_metadata = compiler_fn(
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/jit_compile_runtime_wrappers.py", line 586, in aot_dispatch_autograd
    compiled_fw_func = aot_config.fw_compiler(fw_module, adjusted_flat_args)
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1350, in fw_compiler_base
    return _fw_compiler_base(model, example_inputs, is_inference)
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1421, in _fw_compiler_base
    return inner_compile(
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 475, in compile_fx_inner
    return wrap_compiler_debug(_compile_fx_inner, compiler_name="inductor")(
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_dynamo/repro/after_aot.py", line 85, in debug_wrapper
    inner_compiled_fn = compiler_fn(gm, example_inputs)
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 661, in _compile_fx_inner
    compiled_graph = FxGraphCache.load(
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_inductor/codecache.py", line 1334, in load
    compiled_graph = compile_fx_fn(
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 570, in codegen_and_compile
    compiled_graph = fx_codegen_and_compile(gm, example_inputs, **fx_kwargs)
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 789, in fx_codegen_and_compile
    _recursive_post_grad_passes(gm, is_inference=is_inference)
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 288, in _recursive_post_grad_passes
    post_grad_passes(gm, is_inference)
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_inductor/fx_passes/post_grad.py", line 100, in post_grad_passes
    patterns.apply(gm.graph)  # type: ignore[arg-type]
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_inductor/pattern_matcher.py", line 1729, in apply
    if is_match(m) and entry.extra_check(m):
  File "/mnt/filestore/users/nan/.venv/lib/python3.10/site-packages/torch/_inductor/fx_passes/quantization.py", line 1448, in fn
    scales = match.kwargs["scales"].meta["val"]
```


### Versions

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] nvidia-cublas-cu12==12.4.5.8
[pip3] nvidia-cuda-cupti-cu12==12.4.127
[pip3] nvidia-cuda-nvrtc-cu12==12.4.127
[pip3] nvidia-cuda-runtime-cu12==12.4.127
[pip3] nvidia-cudnn-cu12==9.1.0.70
[pip3] nvidia-cufft-cu12==11.2.1.3
[pip3] nvidia-curand-cu12==10.3.5.147
[pip3] nvidia-cusolver-cu12==11.6.1.9
[pip3] nvidia-cusparse-cu12==12.3.1.170
[pip3] nvidia-nccl-cu12==2.21.5
[pip3] nvidia-nvjitlink-cu12==12.4.127
[pip3] nvidia-nvtx-cu12==12.4.127
[pip3] open_clip_torch==2.28.0
[pip3] optree==0.13.1
[pip3] pytorch-labs-segment-anything-fast==0.2
[pip3] torch==2.5.0
[pip3] torch_scatter==2.1.2.dev4
[pip3] torch-tb-profiler==0.4.3
[pip3] torchao==0.6.1
[pip3] torchaudio==2.5.0
[pip3] torchinfo==1.8.0
[pip3] torchmetrics==1.6.0
[pip3] torchsummary==1.5.1
[pip3] torchvision==0.20.0
[pip3] triton==3.1.0

cc @chauhang @penguinwu @voznesenskym @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @amjames