# Slow LSTM on GPU in Flux

**URL:** https://discourse.julialang.org/t/slow-lstm-on-gpu-in-flux/84228
**Category:** Machine Learning
**Tags:** gpu, flux, pytorch
**Created:** [July 14, 2022, 4:31pm UTC](https://discourse.julialang.org/t/slow-lstm-on-gpu-in-flux/84228 "2022-07-14T16:31:31Z")
**Posts on this page:** 2
**Page:** 2

<div class="post-metadata">

### Author: ![Juan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juan/32/7657_2.png) [@Juan](https://discourse.julialang.org/u/Juan)
#### Post date: [July 21, 2022, 6:21pm UTC](https://discourse.julialang.org/t/slow-lstm-on-gpu-in-flux/84228/21 "2022-07-21T18:21:47Z")

</div>

And there is an alternative to Flux:

> **[GitHub - dfdx/Avalon.jl: Starter kit for legendary models](https://github.com/dfdx/Avalon.jl)**
>
> Starter kit for legendary models. Contribute to dfdx/Avalon.jl development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![kunal](https://avatars.discourse-cdn.com/v4/letter/k/dec6dc/32.png) [@kunal](https://discourse.julialang.org/u/kunal)
#### Post date: [February 15, 2024, 2:14am UTC](https://discourse.julialang.org/t/slow-lstm-on-gpu-in-flux/84228/22 "2024-02-15T02:14:58Z")

</div>

Hey Hi @avikpal  
Thanks for posting this code! I am trying to use LSTM with explicit parameters in Lux.  
Hence your code seems very relevant.

However, I tried running your code, and it spits out error. Sorry I am not very good at reading Julia errors. Could you please help me on this?

```julia
MethodError: no method matching (::Lux.LSTMCell{true, false, false, Tuple{typeof(WeightInitializers.zeros32), typeof(WeightInitializers.zeros32), typeof(WeightInitializers.ones32), typeof(WeightInitializers.zeros32)}, NTuple{4, typeof(WeightInitializers.glorot_uniform)}, typeof(WeightInitializers.zeros32), typeof(WeightInitializers.zeros32)})(::Tuple{Matrix{Float32}, Matrix{Float32}, Tuple{Matrix{Float32}, Matrix{Float32}}}, ::@NamedTuple{weight_i::Matrix{Float32}, weight_h::Matrix{Float32}, bias::Matrix{Float32}}, ::@NamedTuple{rng::Random.TaskLocalRNG})

Closest candidates are:
  (::Lux.LSTMCell{use_bias, false, false})(!Matched::AbstractMatrix, ::Any, ::NamedTuple) where use_bias
   @ Lux C:\Users\.julia\packages\Lux\5xfGO\src\layers\recurrent.jl:397
  (::Lux.LSTMCell{true})(!Matched::Tuple{AbstractMatrix, Tuple{AbstractMatrix, AbstractMatrix}}, ::Any, ::NamedTuple)
   @ Lux C:\Users\.julia\packages\Lux\5xfGO\src\layers\recurrent.jl:436

```

I am on Julia\_v1.10 and Lux@ v0.5.16

[Previous page](https://discourse.julialang.org/t/slow-lstm-on-gpu-in-flux/84228.md?page=1)
