# \#rnn

**URL:** https://discourse.julialang.org/tag/rnn/875.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Issue with backprop in a custom recurrent \`Lux\` layer](https://discourse.julialang.org/t/issue-with-backprop-in-a-custom-recurrent-lux-layer/128968)

<div class="topic-metadata">

**Author:** [@pietro-butti](https://discourse.julialang.org/u/pietro-butti)\
**Replies:** 6\
**Last updated:** [June 16, 2025, 3:44pm UTC](https://discourse.julialang.org/t/issue-with-backprop-in-a-custom-recurrent-lux-layer/128968 "2025-06-16T15:44:58Z")

</div>

I am trying to implement an autoencoder in Lux, inspired by the excellent one that I found in githun.com/lkulowski/LSTM\_encoder\_decoder, coded with PyTorch. (diagram taken from the link) Model overview The encoder i…

---

## [Timeseries model training using Lux.jl](https://discourse.julialang.org/t/timeseries-model-training-using-lux-jl/121618)

<div class="topic-metadata">

**Author:** [@Rosejoycrocker](https://discourse.julialang.org/u/Rosejoycrocker)\
**Replies:** 0\
**Last updated:** [October 22, 2024, 10:36pm UTC](https://discourse.julialang.org/t/timeseries-model-training-using-lux-jl/121618 "2024-10-22T22:36:06Z")

</div>

Hi, I’m using the Lux.jl simple LSTM classifier example ( Training a Simple LSTM | Lux.jl Docs ) to try and train a simple LSTM to predict timeseries data. I’m having issues however, as the LSTM model example is design…

---

## [What's wrong with my training data,RNN network work well on demo but bad on mine](https://discourse.julialang.org/t/whats-wrong-with-my-training-data-rnn-network-work-well-on-demo-but-bad-on-mine/115354)

<div class="topic-metadata">

**Author:** [@Bonjour-Lemonde](https://discourse.julialang.org/u/Bonjour-Lemonde)\
**Replies:** 1\
**Last updated:** [June 8, 2024, 5:23am UTC](https://discourse.julialang.org/t/whats-wrong-with-my-training-data-rnn-network-work-well-on-demo-but-bad-on-mine/115354 "2024-06-08T05:23:51Z")

</div>

Hi all! I had a strange problem using Flux RNN, my training data contains myX:one-hot vector, and myY:a number. The training data shown below worked very well using feedforward network(epoch=20,R2=0.9), but very low usin…

---

## [Issue understanding Lux recurrent cells](https://discourse.julialang.org/t/issue-understanding-lux-recurrent-cells/114249)

<div class="topic-metadata">

**Author:** [@dmetivie](https://discourse.julialang.org/u/dmetivie)\
**Replies:** 1\
**Last updated:** [May 14, 2024, 4:03pm UTC](https://discourse.julialang.org/t/issue-understanding-lux-recurrent-cells/114249 "2024-05-14T16:03:43Z")

</div>

I am trying to turn the following code to Lux.jl def generator(gru\_units, dense\_units, sequence\_length, noise\_dimension, model\_dimension): # Inputs. inputs = tf.keras.layers.Input(shape=(sequence\_length, mod…

---

## [Understanding \`Flux.Data.DataLoader\` when training an LSTM model](https://discourse.julialang.org/t/understanding-flux-data-dataloader-when-training-an-lstm-model/109581)

<div class="topic-metadata">

**Author:** [@Hugo](https://discourse.julialang.org/u/Hugo)\
**Replies:** 1\
**Last updated:** [February 2, 2024, 3:34am UTC](https://discourse.julialang.org/t/understanding-flux-data-dataloader-when-training-an-lstm-model/109581 "2024-02-02T03:34:36Z")

</div>

Hello, folks For a while I have been playing with Flux.jl to learn how to put together ML models, train them, and use them for predictive tasks. At the moment, I am stuck with the training stage of an LSTM model. Probl…

---

## [RNNs in LUX](https://discourse.julialang.org/t/rnns-in-lux/104597)

<div class="topic-metadata">

**Author:** [@pyrex41](https://discourse.julialang.org/u/pyrex41)\
**Replies:** 2\
**Last updated:** [October 19, 2023, 3:25pm UTC](https://discourse.julialang.org/t/rnns-in-lux/104597 "2023-10-19T15:25:34Z")

</div>

I am trying to work out how to build an RNN in Lux, but just using the build-in blocks (instead of the custom approach in the tutorial). I don’t understand why the following basic code throws an error – do i need to be e…

---

## [Help needed to train simple RNN using Flux](https://discourse.julialang.org/t/help-needed-to-train-simple-rnn-using-flux/102650)

<div class="topic-metadata">

**Author:** [@chenwilliam77](https://discourse.julialang.org/u/chenwilliam77)\
**Replies:** 0\
**Last updated:** [August 9, 2023, 7:36pm UTC](https://discourse.julialang.org/t/help-needed-to-train-simple-rnn-using-flux/102650 "2023-08-09T19:36:46Z")

</div>

I am trying to learn a function of time series data using a neural network. In the example below, I’m simulating an AR(1), and I’m trying to learn the function f(x\_t, x\_{t - 1}, x\_{t - 2}, . . .) = x\_t^2 + x\_{t - 1}^2 \*…

---

## [Flux GPU Error with Zygote](https://discourse.julialang.org/t/flux-gpu-error-with-zygote/86192)

<div class="topic-metadata">

**Author:** [@kadir-gunel](https://discourse.julialang.org/u/kadir-gunel)\
**Replies:** 2\
**Last updated:** [August 23, 2022, 12:43pm UTC](https://discourse.julialang.org/t/flux-gpu-error-with-zygote/86192 "2022-08-23T12:43:38Z")

</div>

Hello, I want to build an encoder for text classification model. But some how I get errors when I call Flux.train! method. For the MWE: # Since this is a text based model, an embedding matrix Is needed - this can be p…

---

## [GPU performance and switching from tabular to recurrent data format for Flux.jl](https://discourse.julialang.org/t/gpu-performance-and-switching-from-tabular-to-recurrent-data-format-for-flux-jl/84969)

<div class="topic-metadata">

**Author:** [@JLDC](https://discourse.julialang.org/u/JLDC)\
**Replies:** 5\
**Last updated:** [August 1, 2022, 6:52am UTC](https://discourse.julialang.org/t/gpu-performance-and-switching-from-tabular-to-recurrent-data-format-for-flux-jl/84969 "2022-08-01T06:52:48Z")

</div>

When training a recurrent network using Flux.jl, a dataset with K features, S samples, and a sequence length of L should take the form of a vector of length L where each element is a K × S matrix. Let’s say that I have …

---

## [Evaluate variable-length input array RNN in Julia Flux](https://discourse.julialang.org/t/evaluate-variable-length-input-array-rnn-in-julia-flux/82475)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 4\
**Last updated:** [June 20, 2022, 1:19pm UTC](https://discourse.julialang.org/t/evaluate-variable-length-input-array-rnn-in-julia-flux/82475 "2022-06-20T13:19:59Z")

</div>

How to create a vector of a matrice for variable sequence length data to evaluate untrained RNN? Following the idea developed in these \[link1, link2\] it is possible to carry out the evaluation for a vector; using Flux …

---

## [How to train Flux to learn a sequence conditional to some initial "seeds"?](https://discourse.julialang.org/t/how-to-train-flux-to-learn-a-sequence-conditional-to-some-initial-seeds/78330)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 4\
**Last updated:** [April 2, 2022, 7:15pm UTC](https://discourse.julialang.org/t/how-to-train-flux-to-learn-a-sequence-conditional-to-some-initial-seeds/78330 "2022-04-02T19:15:35Z")

</div>

I am trying to write a RNN that given an initial “seed” sequence, it reproduces the continuation of the sequence. In the code above dummy sequences are generated as function of these initial seed points and a RNN approa…

---

## [RNN Sentiment analysis example with Flux: how to use batch ? which value for the inner state?](https://discourse.julialang.org/t/rnn-sentiment-analysis-example-with-flux-how-to-use-batch-which-value-for-the-inner-state/78224)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 0\
**Last updated:** [March 21, 2022, 4:05pm UTC](https://discourse.julialang.org/t/rnn-sentiment-analysis-example-with-flux-how-to-use-batch-which-value-for-the-inner-state/78224 "2022-03-21T16:05:42Z")

</div>

Hello, the code belows model a RNN for sentiment analysis over Amazon reviews. My main problem is that I don’t know how to batch a recursive cell when the sequence (i.e. the review text) has variable length. In the \[do…

---

## [Flux: no method matching ndims(::ChainRulesCore.NoTangent)](https://discourse.julialang.org/t/flux-no-method-matching-ndims-chainrulescore-notangent/71479)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 3\
**Last updated:** [November 17, 2021, 2:06am UTC](https://discourse.julialang.org/t/flux-no-method-matching-ndims-chainrulescore-notangent/71479 "2021-11-17T02:06:49Z")

</div>

Consider the MWE below. using Flux model = Chain( RNN(1, 128), Dense(128, 1) ); # one feature, sequence length = 3, batch size = 6 x = \[rand(Float32, 1, 6) for \_ = 1:3\] y = rand(Float32, 1, 6) function loss(…
