# Quantum Transfer Learning

**URL:** <https://discuss.pennylane.ai/t/quantum-transfer-learning/942>\
**Category:** PennyLane Help\
**Created:** [March 25, 2021, 7:44am UTC](https://discuss.pennylane.ai/t/quantum-transfer-learning/942 "2021-03-25T07:44:27Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![isaacdevlugt](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/isaacdevlugt/32/1159_2.png) [@isaacdevlugt](https://discuss.pennylane.ai/u/isaacdevlugt)\
**Post date:** [November 8, 2023, 10:31pm UTC](https://discuss.pennylane.ai/t/quantum-transfer-learning/942/8 "2023-11-08T22:31:35Z")

</div>

Hey @kevinkawchak,

It looks like somewhere along the line you’re creating a torch tensor on a cpu device instead of a gpu device (or the other way around). You’ll need to do something like this:

```auto
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
input_tensor = input_tensor.to(device)
output_tensor = output_tensor.to(device)

```

or you can set the default device like this (see here: [torch.set\_default\_device — PyTorch 2.1 documentation](https://pytorch.org/docs/stable/generated/torch.set_default_device.html))

```auto
>>> torch.tensor([1.2, 3]).device
device(type='cpu')
>>> torch.set_default_device('cuda') # current device is 0
>>> torch.tensor([1.2, 3]).device
device(type='cuda', index=0)
>>> torch.set_default_device('cuda:1')
>>> torch.tensor([1.2, 3]).device
device(type='cuda', index=1)

```

Let me know if this helps!

---

_[View the full topic](https://discuss.pennylane.ai/t/quantum-transfer-learning/942)._
