[dynamo]: Unsupported: call_method ListVariable() copy [] {}
Labels: triaged, oncall: pt2, module: dynamo

### 🐛 Describe the bug

Using nightlies (and triton from `HEAD`, though unlikely that matters here), I am unable to use `torch.compile(model, fullgraph=True, dynamic=False)` with SWinv2 provided by `torchvision` due to this line: https://github.com/pytorch/vision/blob/b094075cbc8834d63a9fa8ae08bcad3d72a43321/torchvision/models/swin_transformer.py#L156

```python
shift_size = shift_size.copy()
```

It makes a local copy of a list of integers passed by reference to avoid mutations in the method affecting the original.

Excerpt from traceback:

```python
...
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/exc.py", line 71, in unimplemented
    raise Unsupported(msg)
torch._dynamo.exc.Unsupported: call_method ListVariable() copy [] {}

from user code:
   File "/usr/local/lib/python3.10/site-packages/torchvision-0.15.0a0-py3.10-linux-x86_64.egg/torchvision/models/swin_transformer.py", line 381, in forward
    return shifted_window_attention(
  File "/usr/local/lib/python3.10/site-packages/torchvision-0.15.0a0-py3.10-linux-x86_64.egg/torchvision/models/swin_transformer.py", line 156, in shifted_window_attention
    shift_size = shift_size.copy()
```

This could be fixed by rewriting the `.copy` as a list comprehension (`shift_size = [n for n in shift_size]`), which I have done locally to ensure that fixes the issue. (And so this would belong in Torchvision's issue tracker.)

However, the `copy` method is commonplace and more concise than a list comprehension which does effectively the same thing.

What would the level of effort be to add support for `copy` to Dynamo, even if only for primitive types? (I'm not sure what would be involved in supporting `copy` with arbitrary objects.)

### Error logs

<details>

```python
Traceback (most recent call last):
  File "/bsrt/bsrt/main.py", line 144, in <module>
    trainer.fit(  # type: ignore
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 608, in fit
    call._call_and_handle_interrupt(
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/trainer/call.py", line 38, in _call_and_handle_interrupt
    return trainer_fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 650, in _fit_impl
    self._run(model, ckpt_path=self.ckpt_path)
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 1103, in _run
    results = self._run_stage()
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 1182, in _run_stage
    self._run_train()
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 1205, in _run_train
    self.fit_loop.run()
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/loops/loop.py", line 199, in run
    self.advance(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/loops/fit_loop.py", line 267, in advance
    self._outputs = self.epoch_loop.run(self._data_fetcher)
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/loops/loop.py", line 199, in run
    self.advance(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/loops/epoch/training_epoch_loop.py", line 213, in advance
    batch_output = self.batch_loop.run(kwargs)
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/loops/loop.py", line 199, in run
    self.advance(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/loops/batch/training_batch_loop.py", line 88, in advance
    outputs = self.optimizer_loop.run(optimizers, kwargs)
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/loops/loop.py", line 199, in run
    self.advance(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/loops/optimization/optimizer_loop.py", line 202, in advance
    result = self._run_optimization(kwargs, self._optimizers[self.optim_progress.optimizer_position])
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/loops/optimization/optimizer_loop.py", line 241, in _run_optimization
    closure()
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/loops/optimization/optimizer_loop.py", line 149, in __call__
    self._result = self.closure(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/loops/optimization/optimizer_loop.py", line 135, in closure
    step_output = self._step_fn()
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/loops/optimization/optimizer_loop.py", line 419, in _training_step
    training_step_output = self.trainer._call_strategy_hook("training_step", *kwargs.values())
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 1485, in _call_strategy_hook
    output = fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/pytorch_lightning/strategies/strategy.py", line 378, in training_step
    return self.model.training_step(*args, **kwargs)
  File "/bsrt/bsrt/lightning_bsrt.py", line 206, in training_step
    srs: Tensor = self(bursts)
  File "/usr/local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/bsrt/bsrt/lightning_bsrt.py", line 198, in forward
    ret: Tensor = self.model(bursts)
  File "/usr/local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 82, in forward
    return self.dynamo_ctx(self._orig_mod.forward)(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 209, in _fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 330, in catch_errors
    return callback(frame, cache_size, hooks)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 103, in _fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 261, in _convert_frame_assert
    return _compile(
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 162, in time_wrapper
    r = func(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 323, in _compile
    out_code = transform_code_object(code, transform)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/bytecode_transformation.py", line 339, in transform_code_object
    transformations(instructions, code_options)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 310, in transform
    tracer.run()
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1715, in run
    super().run()
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 564, in run
    and self.step()
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 527, in step
    getattr(self, inst.opname)(inst)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 333, in wrapper
    return inner_fn(self, inst)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 990, in CALL_FUNCTION
    self.call_function(fn, args, {})
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 461, in call_function
    self.push(fn.call_function(self, args, kwargs))
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py", line 289, in call_function
    return super().call_function(tx, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py", line 259, in call_function
    return super(UserFunctionVariable, self).call_function(tx, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py", line 92, in call_function
    return tx.inline_user_function_return(
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 497, in inline_user_function_return
    result = InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1793, in inline_call
    return cls.inline_call_(parent, func, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1849, in inline_call_
    tracer.run()
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 564, in run
    and self.step()
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 527, in step
    getattr(self, inst.opname)(inst)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 333, in wrapper
    return inner_fn(self, inst)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 990, in CALL_FUNCTION
    self.call_function(fn, args, {})
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 461, in call_function
    self.push(fn.call_function(self, args, kwargs))
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/variables/nn_module.py", line 244, in call_function
    return tx.inline_user_function_return(
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 497, in inline_user_function_return
    result = InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1793, in inline_call
    return cls.inline_call_(parent, func, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1849, in inline_call_
    tracer.run()
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 564, in run
    and self.step()
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 527, in step
    getattr(self, inst.opname)(inst)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 333, in wrapper
    return inner_fn(self, inst)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 990, in CALL_FUNCTION
    self.call_function(fn, args, {})
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 461, in call_function
    self.push(fn.call_function(self, args, kwargs))
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/variables/nn_module.py", line 184, in call_function
    tx.call_function(
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 461, in call_function
    self.push(fn.call_function(self, args, kwargs))
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/variables/nn_module.py", line 244, in call_function
    return tx.inline_user_function_return(
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 497, in inline_user_function_return
    result = InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1793, in inline_call
    return cls.inline_call_(parent, func, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1849, in inline_call_
    tracer.run()
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 564, in run
    and self.step()
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 527, in step
    getattr(self, inst.opname)(inst)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 333, in wrapper
    return inner_fn(self, inst)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 990, in CALL_FUNCTION
    self.call_function(fn, args, {})
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 461, in call_function
    self.push(fn.call_function(self, args, kwargs))
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/variables/nn_module.py", line 244, in call_function
    return tx.inline_user_function_return(
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 497, in inline_user_function_return
    result = InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1793, in inline_call
    return cls.inline_call_(parent, func, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1849, in inline_call_
    tracer.run()
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 564, in run
    and self.step()
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 527, in step
    getattr(self, inst.opname)(inst)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 333, in wrapper
    return inner_fn(self, inst)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1039, in CALL_FUNCTION_KW
    self.call_function(fn, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 461, in call_function
    self.push(fn.call_function(self, args, kwargs))
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py", line 259, in call_function
    return super(UserFunctionVariable, self).call_function(tx, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py", line 92, in call_function
    return tx.inline_user_function_return(
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 497, in inline_user_function_return
    result = InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1793, in inline_call
    return cls.inline_call_(parent, func, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1849, in inline_call_
    tracer.run()
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 564, in run
    and self.step()
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 527, in step
    getattr(self, inst.opname)(inst)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 333, in wrapper
    return inner_fn(self, inst)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 990, in CALL_FUNCTION
    self.call_function(fn, args, {})
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 461, in call_function
    self.push(fn.call_function(self, args, kwargs))
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/variables/misc.py", line 674, in call_function
    return self.obj.call_method(tx, self.name, args, kwargs).add_options(self)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/variables/lists.py", line 239, in call_method
    return super().call_method(tx, name, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/variables/lists.py", line 101, in call_method
    return super(BaseListVariable, self).call_method(tx, name, args, kwargs)
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/variables/base.py", line 253, in call_method
    raise unimplemented(f"call_method {self} {name} {args} {kwargs}")
  File "/usr/local/lib/python3.10/site-packages/torch/_dynamo/exc.py", line 71, in unimplemented
    raise Unsupported(msg)
torch._dynamo.exc.Unsupported: call_method ListVariable() copy [] {}

from user code:
   File "/usr/local/lib/python3.10/site-packages/torchvision-0.15.0a0-py3.10-linux-x86_64.egg/torchvision/models/swin_transformer.py", line 381, in forward
    return shifted_window_attention(
  File "/usr/local/lib/python3.10/site-packages/torchvision-0.15.0a0-py3.10-linux-x86_64.egg/torchvision/models/swin_transformer.py", line 156, in shifted_window_attention
    shift_size = shift_size.copy()

Set torch._dynamo.config.verbose=True for more information


You can suppress this exception and fall back to eager by setting:
    torch._dynamo.config.suppress_errors = True
```

</details>

### Minified repro

_No response_

### Versions

```text
PyTorch version: 2.0.0a0+git569f2e3
Is debug build: False
CUDA used to build PyTorch: 11.8
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: 16.0.0 (++20230130103025+16a5dd495d02-1~exp1~20230130223133.7)
CMake version: version 3.25.2
Libc version: glibc-2.35

Python version: 3.10.9+ (main, Feb  1 2023, 12:46:32) [Clang 16.0.0 (++20230130103025+16a5dd495d02-1~exp1~20230130223133.7)] (64-bit runtime)
Python platform: Linux-6.1.8-200.fc37.x86_64-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 11.8.89
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 4090
Nvidia driver version: 525.85.12
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.7.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.7.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.7.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.7.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.7.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.7.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.7.0
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.21.4
[pip3] pytorch-lightning==1.9.0
[pip3] torch==2.0.0a0+git569f2e3
[pip3] torch-fidelity==0.3.0
[pip3] torchmetrics==0.11.1
[pip3] torchvision==0.15.0a0
[conda] Could not collect
```

cc @ezyang @soumith @msaroufim @wconstab @ngimel @bdhirsh @mlazos @voznesenskym @yanboliang @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @desertfire