Repository: pytorch
Issue: Dynamo can not trace 'int(a_scalar_tensor.item())'
Labels: triaged,has workaround,bug,oncall: pt2,module: dynamic shapes,oncall: export

### 🐛 Describe the bug

RCNN model in detectron2 need this support:  ( https://www.internalfb.com/code/fbsource/[ca89130b9eae0efd5bb1cbbff1006cc1556d0b4f]/fbcode/vision/fair/detectron2/detectron2/export/c10.py?lines=483-489 )



### Error logs

Traceback (most recent call last):
  File "/home/shunting/learn/dynamo/temp.py", line 12, in <module>
    gm, guards = export(f, inp, aten_graph=True, tracing_mode="symbolic")
  File "/home/shunting/pytorch/torch/_dynamo/eval_frame.py", line 605, in export
    result_traced = opt_f(*args, **kwargs)
  File "/home/shunting/pytorch/torch/_dynamo/eval_frame.py", line 211, in _fn
    return fn(*args, **kwargs)
  File "/home/shunting/pytorch/torch/_dynamo/eval_frame.py", line 332, in catch_errors
    return callback(frame, cache_size, hooks)
  File "/home/shunting/pytorch/torch/_dynamo/convert_frame.py", line 103, in _fn
    return fn(*args, **kwargs)
  File "/home/shunting/pytorch/torch/_dynamo/convert_frame.py", line 261, in _convert_frame_assert
    return _compile(
  File "/home/shunting/pytorch/torch/_dynamo/utils.py", line 154, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/shunting/pytorch/torch/_dynamo/convert_frame.py", line 324, in _compile
    out_code = transform_code_object(code, transform)
  File "/home/shunting/pytorch/torch/_dynamo/bytecode_transformation.py", line 341, in transform_code_object
    transformations(instructions, code_options)
  File "/home/shunting/pytorch/torch/_dynamo/convert_frame.py", line 311, in transform
    tracer.run()
  File "/home/shunting/pytorch/torch/_dynamo/symbolic_convert.py", line 1693, in run
    super().run()
  File "/home/shunting/pytorch/torch/_dynamo/symbolic_convert.py", line 539, in run
    and self.step()
  File "/home/shunting/pytorch/torch/_dynamo/symbolic_convert.py", line 502, in step
    getattr(self, inst.opname)(inst)
  File "/home/shunting/pytorch/torch/_dynamo/symbolic_convert.py", line 307, in wrapper
    return inner_fn(self, inst)
  File "/home/shunting/pytorch/torch/_dynamo/symbolic_convert.py", line 975, in CALL_FUNCTION
    self.call_function(fn, args, {})
  File "/home/shunting/pytorch/torch/_dynamo/symbolic_convert.py", line 435, in call_function
    self.push(fn.call_function(self, args, kwargs))
  File "/home/shunting/pytorch/torch/_dynamo/variables/builtin.py", line 346, in call_function
    return super().call_function(tx, args, kwargs)
  File "/home/shunting/pytorch/torch/_dynamo/variables/base.py", line 230, in call_function
    unimplemented(f"call_function {self} {args} {kwargs}")
  File "/home/shunting/pytorch/torch/_dynamo/exc.py", line 71, in unimplemented
    raise Unsupported(msg)
torch._dynamo.exc.Unsupported: call_function BuiltinVariable(int) [TensorVariable()] {}

### Minified repro

```
from torch._dynamo import export
from torch._dynamo import config
import torch
from torch import nn

config.capture_scalar_outputs = True
inp = torch.rand(3)

def f(inp):
    return torch.full(int(inp[0].item()), 5)

gm, guards = export(f, inp, aten_graph=True, tracing_mode="symbolic")
print(f"Export return graph:\n{gm.graph}")
```

cc @ezyang @msaroufim @wconstab @bdhirsh @anijain2305 @zou3519 @avikchaudhuri @gmagogsfm @zhxchen17 @tugsbayasgalan @angelayi @suo @ydwu4 @soumith @ngimel