# Flux: Embeddings on GPU

**URL:** <https://discourse.julialang.org/t/flux-embeddings-on-gpu/55280>\
**Category:** Machine Learning\
**Tags:** gpu, flux\
**Created:** [February 14, 2021, 11:42pm UTC](https://discourse.julialang.org/t/flux-embeddings-on-gpu/55280 "2021-02-14T23:42:49Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [February 21, 2021, 6:05pm UTC](https://discourse.julialang.org/t/flux-embeddings-on-gpu/55280/2 "2021-02-21T18:05:39Z")

</div>

Have a look at [How to implement embeddings in Flux that aren't tragically slow? - #2 by dhairyagandhi96](https://discourse.julialang.org/t/how-to-implement-embeddings-in-flux-that-arent-tragically-slow/55201/2). Embeddings are an interesting case because they’re trivial to implement as a loop on GPU, but extremely difficult to express as a vectorized computation. If you just want something that works, [Transformers.jl/embed.jl at master · chengchingwen/Transformers.jl · GitHub](https://github.com/chengchingwen/Transformers.jl/blob/master/src/basic/embeds/embed.jl) has a working implementation and there’s a [PR](https://github.com/FluxML/NNlib.jl/pull/255) out to add something like it to NNlib.

---

_[View the full topic](https://discourse.julialang.org/t/flux-embeddings-on-gpu/55280)._
