```python
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/torch/fx/graph_module.py", line 267, in __call__
return super(self.cls, obj).__call__(*args, **kwargs) # type: ignore[misc]
File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File ".39", line 34, in forward
cat = torch.cat([embeddings_dropout, ones], dim = -1); ones = None
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument tensors in method wrapper_cat)
Call using an FX-traced Module, line 34 of the traced Module's generated forward function:
ones = torch.ones(add_87); add_87 = None
cat = torch.cat([embeddings_dropout, ones], dim = -1); ones = None
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
encoder_layer_0_attention_self_query = getattr(self.encoder.layer, "0").attention.self.query(cat); cat = None
getattr_2 = embeddings_dropout.shape
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
[](https://localhost:8080/#) in
4 transformed_bert = composition(traced_bert)
5 transformed_bert.to(device)
----> 6 transformed_outputs = transformed_bert(**bert_inputs)
7
8 # verify outputs
1 frames
[/usr/local/lib/python3.8/dist-packages/torch/fx/graph_module.py](https://localhost:8080/#) in __call__(self, obj, *args, **kwargs)
273 print(_WrappedCall._generate_error_message(topmost_framesummary),
274 file=sys.stderr)
--> 275 raise e.with_traceback(None)
276 else:
277 raise e
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument tensors in method wrapper_cat)
```
System Info
Who can help?
@regisss
In this line here, device could be specified:
I tested it.
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
To reproduce this error:
TraceBack:
Expected behavior
To run without error.