Repository: pytorch
Issue: [Dynamo] compile torch.logit with different data types
Labels: triaged,oncall: pt2,module: dynamic shapes

### 🐛 Describe the bug

When fixing https://github.com/pytorch/pytorch/issues/145379, I met a failure which seems related to dynamo. If test with `torch.float64`, below example works well. However, it fails with `torch.float32` with error
```
  File "/home/leslie/community/pytorch/torch/_dynamo/variables/builder.py", line 2167, in wrap_fx_proxy
    return wrap_fx_proxy_cls(target_cls=TensorVariable, **kwargs)
  File "/home/leslie/community/pytorch/torch/_dynamo/variables/builder.py", line 2233, in wrap_fx_proxy_cls
    return _wrap_fx_proxy(
  File "/home/leslie/community/pytorch/torch/_dynamo/variables/builder.py", line 2329, in _wrap_fx_proxy
    example_value = get_fake_value(proxy.node, tx, allow_non_graph_fake=True)
  File "/home/leslie/community/pytorch/torch/_dynamo/utils.py", line 2965, in get_fake_value
    unimplemented(
  File "/home/leslie/community/pytorch/torch/_dynamo/exc.py", line 361, in unimplemented
    raise Unsupported(msg, case_name=case_name)
torch._dynamo.exc.Unsupported: data dependent operator: aten._local_scalar_dense.default; to enable, set torch._dynamo.config.capture_scalar_outputs = True

from user code:
   File "/home/leslie/community/pytorch/torch/_dynamo/external_utils.py", line 48, in inner
    return fn(*args, **kwargs)

Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information


You can suppress this exception and fall back to eager by setting:
    import torch._dynamo
    torch._dynamo.config.suppress_errors = True
```

Repro:
```
import torch

# dtype = torch.float64 # Pass
dtype = torch.float32  # Fail

input = torch.tensor(0.3, dtype=dtype)
eps = torch.tensor(0.9, dtype=dtype)
compiled = torch.compile(torch.logit, fullgraph=True)
print(compiled(input, eps))
```

### Versions

```
[pip3] flake8==6.1.0
[pip3] flake8-bugbear==23.3.23
[pip3] flake8-comprehensions==3.15.0
[pip3] flake8-executable==2.1.3
[pip3] flake8-logging-format==0.9.0
[pip3] flake8-pyi==23.3.1
[pip3] flake8-simplify==0.19.3
[pip3] mypy==1.11.2
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.26.0
[pip3] onnx==1.17.0
[pip3] optree==0.13.0
[pip3] torch==2.7.0a0+git95a92b5
[pip3] torchaudio==2.5.0a0+a95cfa8
[pip3] torchdata==0.10.0a0+2631c38
[pip3] torchmultimodal==0.1.0b0
[pip3] torchtext==0.17.0a0+1d4ce73
[pip3] torchvision==0.20.0a0+945bdad
[conda] mkl                       2024.2.2            ha957f24_15    conda-forge
[conda] mkl-include               2024.2.2            ha957f24_15    conda-forge
[conda] numpy                     1.26.0                   pypi_0    pypi
[conda] optree                    0.13.0                   pypi_0    pypi
[conda] torch                     2.7.0a0+git95a92b5           dev_0    <develop>
[conda] torchaudio                2.5.0a0+a95cfa8           dev_0    <develop>
[conda] torchdata                 0.10.0a0+2631c38           dev_0    <develop>
[conda] torchfix                  0.4.0                    pypi_0    pypi
[conda] torchmultimodal           0.1.0b0                  pypi_0    pypi
[conda] torchtext                 0.17.0a0+1d4ce73           dev_0    <develop>
[conda] torchvision               0.20.0a0+945bdad           dev_0    <develop>

```

cc @chauhang @penguinwu @ezyang @bobrenjc93