# Current upsampling layers

**URL:** <https://discourse.julialang.org/t/current-upsampling-layers/73286>\
**Category:** General Usage\
**Tags:** gpu, flux\
**Created:** [December 17, 2021, 10:40pm UTC](https://discourse.julialang.org/t/current-upsampling-layers/73286 "2021-12-17T22:40:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Avec](https://avatars.discourse-cdn.com/v4/letter/a/a88e57/32.png) [@Avec](https://discourse.julialang.org/u/Avec)\
**Post date:** [December 17, 2021, 10:40pm UTC](https://discourse.julialang.org/t/current-upsampling-layers/73286/1 "2021-12-17T22:40:48Z")

</div>

Hi,  
what are the current options for upsampling layers in Flux that run on GPU? I am using ConvTranspose, but I would like to try out something else. I found Upsample(scale, mode) in documentation but it is extremely slow.  
Thanks for an answer,

---

<div class="post-metadata">

**Author:** ![ToucheSir](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/touchesir/32/14411_2.png) [@ToucheSir](https://discourse.julialang.org/u/ToucheSir)\
**Post date:** [December 20, 2021, 5:01pm UTC](https://discourse.julialang.org/t/current-upsampling-layers/73286/2 "2021-12-20T17:01:37Z")

</div>

What mode are you using for upsampling? Some will be more efficient than others because they essentially do less work. I would also not expect any of them to be slower than the equivalent operation in other libraries, if that is your concern.

---

<div class="post-metadata">

**Author:** ![Avec](https://avatars.discourse-cdn.com/v4/letter/a/a88e57/32.png) [@Avec](https://discourse.julialang.org/u/Avec)\
**Post date:** [December 21, 2021, 8:26am UTC](https://discourse.julialang.org/t/current-upsampling-layers/73286/3 "2021-12-21T08:26:17Z")

</div>

The code I am trying to replicate in julia uses bilinear upsampling so I hoped that it would work, but unfortunately there are some scalar operations in that function that make it extremely slow on gpu. Anyway, thanks for your reply.

---

<div class="post-metadata">

**Author:** ![ToucheSir](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/touchesir/32/14411_2.png) [@ToucheSir](https://discourse.julialang.org/u/ToucheSir)\
**Post date:** [December 21, 2021, 10:29pm UTC](https://discourse.julialang.org/t/current-upsampling-layers/73286/4 "2021-12-21T22:29:00Z")

</div>

[Model Reference · Flux](https://fluxml.ai/Flux.jl/stable/models/layers/#Flux.Upsample) shouldn’t be doing _any_ scalar operations, there’s a fully GPU-optimized kernel in NNlibCUDA.jl. Can you confirm you’re using  
`Upsample(:bilinear, ...)` or [`NNlib.upsample_bilinear`](https://fluxml.ai/Flux.jl/stable/models/nnlib/#NNlib.upsample_bilinear)?

---

<div class="post-metadata">

**Author:** ![Avec](https://avatars.discourse-cdn.com/v4/letter/a/a88e57/32.png) [@Avec](https://discourse.julialang.org/u/Avec)\
**Post date:** [December 22, 2021, 2:18pm UTC](https://discourse.julialang.org/t/current-upsampling-layers/73286/5 "2021-12-22T14:18:22Z")

</div>

Hi, so the problem was actually with old versions of packages. I feel bad that I have missed something so obvious. It woks smooth with the newest versions. Thanks for your help.
