# Simple Flux LSTM for Time Series

**URL:** https://discourse.julialang.org/t/simple-flux-lstm-for-time-series/35494
**Category:** Machine Learning
**Tags:** question, flux, time-series, machine-learning
**Created:** [March 4, 2020, 1:10am UTC](https://discourse.julialang.org/t/simple-flux-lstm-for-time-series/35494 "2020-03-04T01:10:12Z")
**Posts on this page:** 3
**Page:** 4

<div class="post-metadata">

### Author: ![JLDC](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jldc/32/17627_2.png) [@JLDC](https://discourse.julialang.org/u/JLDC)
#### Post date: [April 11, 2022, 6:35pm UTC](https://discourse.julialang.org/t/simple-flux-lstm-for-time-series/35494/61 "2022-04-11T18:35:52Z")

</div>

I’m not sure where you get this model reference from. The official reference uses the code I mentioned above.

[https://fluxml.ai/Flux.jl/stable/models/layers/#Flux.LSTM](https://fluxml.ai/Flux.jl/stable/models/layers/#Flux.LSTM)  
[https://fluxml.ai/Flux.jl/stable/models/layers/#Flux.GRU](https://fluxml.ai/Flux.jl/stable/models/layers/#Flux.GRU)

Even an outdated version of the docs should not have some activation function for LSTM and GRU due to the way these networks work. There is no activation function in the same sense as there is for RNN or Dense layers.

In my opinion, this resource, which I found to be quite useful, makes it clearer why a user-defined activation function for LSTM does not make sense: [Understanding LSTM Networks -- colah's blog](https://colah.github.io/posts/2015-08-Understanding-LSTMs/). I hope this helps!

---

<div class="post-metadata">

### Author: ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)
#### Post date: [April 11, 2022, 6:50pm UTC](https://discourse.julialang.org/t/simple-flux-lstm-for-time-series/35494/62 "2022-04-11T18:50:56Z")

</div>

> [@JLDC](#):
>
> I’m not sure where you get this model reference from

[https://fluxml.ai/Flux.jl/v0.5/models/layers.html](https://fluxml.ai/Flux.jl/v0.5/models/layers.html)

[The top google search for Julia Flux LSTM]

---

<div class="post-metadata">

### Author: ![JLDC](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jldc/32/17627_2.png) [@JLDC](https://discourse.julialang.org/u/JLDC)
#### Post date: [April 11, 2022, 7:02pm UTC](https://discourse.julialang.org/t/simple-flux-lstm-for-time-series/35494/63 "2022-04-11T19:02:45Z")

</div>

I stand corrected. So an older version does indeed have a parameter for an activation function, I’m not sure why that would be useful, perhaps someone more knowledgeable can chime in. It is unfortunate that Google returns an old version of the docs. Do use the one I linked above, it is the stable version.

Note that you could also add any custom function to the output of the LSTM using `Chain`.

```julia
Chain(LSTM(in, out), x -> σ.(x))

```

[Previous page](https://discourse.julialang.org/t/simple-flux-lstm-for-time-series/35494.md?page=3)
