# Error: Tensor for 'out' is on CPU, Tensor for argument #1 'self' is on CPU, but expected them to be on GPU (while checking arguments for addmm)

**URL:** <https://discuss.pytorch.org/t/error-tensor-for-out-is-on-cpu-tensor-for-argument-1-self-is-on-cpu-but-expected-them-to-be-on-gpu-while-checking-arguments-for-addmm/123668>\
**Category:** Uncategorized\
**Created:** [June 9, 2021, 8:56am UTC](https://discuss.pytorch.org/t/error-tensor-for-out-is-on-cpu-tensor-for-argument-1-self-is-on-cpu-but-expected-them-to-be-on-gpu-while-checking-arguments-for-addmm/123668 "2021-06-09T08:56:39Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [June 9, 2021, 9:28am UTC](https://discuss.pytorch.org/t/error-tensor-for-out-is-on-cpu-tensor-for-argument-1-self-is-on-cpu-but-expected-them-to-be-on-gpu-while-checking-arguments-for-addmm/123668/2 "2021-06-09T09:28:12Z")

</div>

The `nn.Linear` layer is created on the CPU, so you would need to transfer it to the GPU as well:

```python
layer = nn.Linear(784, 10).to(dev)
lin = layer(flatten)

```

---

_[View the full topic](https://discuss.pytorch.org/t/error-tensor-for-out-is-on-cpu-tensor-for-argument-1-self-is-on-cpu-but-expected-them-to-be-on-gpu-while-checking-arguments-for-addmm/123668)._
