# Problem when moving model to cuda

**URL:** <https://discuss.pytorch.org/t/problem-when-moving-model-to-cuda/90549>\
**Category:** Uncategorized\
**Created:** [July 26, 2020, 1:37am UTC](https://discuss.pytorch.org/t/problem-when-moving-model-to-cuda/90549 "2020-07-26T01:37:45Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![DBraun](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/dbraun/32/24595_2.png) [@DBraun](https://discuss.pytorch.org/u/DBraun)\
**Post date:** [July 28, 2020, 1:24am UTC](https://discuss.pytorch.org/t/problem-when-moving-model-to-cuda/90549/5 "2020-07-28T01:24:22Z")

</div>

@ptrblck Could you inspect some similar code here? [https://github.com/NathanUA/U-2-Net/blob/b77cd6da3204efcb03e18e15dd3b9eb24d47f969/model/u2net.py#L24](https://github.com/NathanUA/U-2-Net/blob/b77cd6da3204efcb03e18e15dd3b9eb24d47f969/model/u2net.py#L24)

`_upsample_like` is called only in the `forward` pass just like OP’s `self.upsampling`

I wonder if this is the cause of my libtorch `module.forward()` not working even though my python jit trace saves and imports in libtorch without errors.

If you think it is the cause, what is a concise fix considering `_upsample_like` is written a lot in all the `forward` implementations?

My other thread is here [Debugging runtime error module-\>forward(inputs) libtorch 1.4](https://discuss.pytorch.org/t/debugging-runtime-error-module-forward-inputs-libtorch-1-4/82415)

---

_[View the full topic](https://discuss.pytorch.org/t/problem-when-moving-model-to-cuda/90549)._
