Repository: pytorch
Issue: `torch.compile` fails with runtime error on Numpy scalar operations
Labels: triaged,module: numpy,oncall: pt2,dynamo-user-empathy-day

### 🐛 Describe the bug

The following pattern shows up in a model from User Empathy Day: https://github.com/suno-ai/bark/blob/f4f32d4cd480dfec1c245d258174bc9bde3c2148/bark/generation.py#L602-L607

```python
@torch.compile(backend="eager")
def run(x):
    n = int(round(np.floor(3.1)))
    return x + n
run(torch.ones(1))
```

### Error logs

```
Traceback (most recent call last):
  File "/Users/ryanguo99/Documents/work/scratch/test.py", line 26, in <module>
    test()
  File "/Users/ryanguo99/Documents/work/scratch/test.py", line 24, in test
    run(torch.ones(1))
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/eval_frame.py", line 556, in _fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/convert_frame.py", line 1403, in __call__
    return self._torchdynamo_orig_callable(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/convert_frame.py", line 1187, in __call__
    result = self._inner_convert(
             ^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/convert_frame.py", line 549, in __call__
    return _compile(
           ^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/convert_frame.py", line 984, in _compile
    guarded_code = compile_inner(code, one_graph, hooks, transform)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/convert_frame.py", line 712, in compile_inner
    return _compile_inner(code, one_graph, hooks, transform)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_utils_internal.py", line 95, in wrapper_function
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/convert_frame.py", line 747, in _compile_inner
    out_code = transform_code_object(code, transform)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/bytecode_transformation.py", line 1348, in transform_code_object
    transformations(instructions, code_options)
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/convert_frame.py", line 233, in _fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/convert_frame.py", line 664, in transform
    tracer.run()
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/symbolic_convert.py", line 2841, in run
    super().run()
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/symbolic_convert.py", line 1032, in run
    while self.step():
          ^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/symbolic_convert.py", line 944, in step
    self.dispatch_table[inst.opcode](self, inst)
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/symbolic_convert.py", line 641, in wrapper
    return inner_fn(self, inst)
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/symbolic_convert.py", line 2314, in CALL
    self._call(inst)
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/symbolic_convert.py", line 2308, in _call
    self.call_function(fn, args, kwargs)
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/symbolic_convert.py", line 879, in call_function
    self.push(fn.call_function(self, args, kwargs))  # type: ignore[arg-type]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/variables/builtin.py", line 1004, in call_function
    return handler(tx, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/variables/builtin.py", line 852, in builtin_dispatch
    rv = fn(tx, args, kwargs)
         ^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/variables/builtin.py", line 772, in call_self_handler
    result = self_handler(tx, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/variables/builtin.py", line 1235, in call_round
    return round_method.call_function(tx, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/variables/misc.py", line 1032, in call_function
    return self.obj.call_method(tx, self.name, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/variables/tensor.py", line 1334, in call_method
    return NumpyNdarrayVariable.create(tx, proxy)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/variables/tensor.py", line 1238, in create
    return wrap_fx_proxy_cls(
           ^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/variables/builder.py", line 2182, in wrap_fx_proxy_cls
    return _wrap_fx_proxy(
           ^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/variables/builder.py", line 2278, in _wrap_fx_proxy
    example_value = get_fake_value(proxy.node, tx, allow_non_graph_fake=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/utils.py", line 2377, in get_fake_value
    raise TorchRuntimeError(str(e)).with_traceback(e.__traceback__) from None
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/utils.py", line 2312, in get_fake_value
    ret_val = wrap_fake_exception(
              ^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/utils.py", line 1858, in wrap_fake_exception
    return fn()
           ^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/utils.py", line 2313, in <lambda>
    lambda: run_node(tx.output, node, args, kwargs, nnmodule)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/utils.py", line 2445, in run_node
    raise RuntimeError(make_error_message(e)).with_traceback(
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/utils.py", line 2427, in run_node
    return node.target(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryanguo99/Documents/work/pytorch/torch/_dynamo/utils.py", line 2770, in __call__
    method_callable = getattr(obj, self.method)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
torch._dynamo.exc.TorchRuntimeError: Failed running call_function <Wrapped method <original __round__>>(*(FakeTensor(..., size=(), dtype=torch.float64),), **{}):
'ndarray' object has no attribute '__round__'

from user code:
   File "/Users/ryanguo99/Documents/work/scratch/test.py", line 22, in run
    n = int(round(np.floor(3.1)))

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
```

### Versions

`7ced49d2ccf`, Python 3.12

cc @mruberry @rgommers @chauhang @penguinwu