# LSTM Method Error - Time Series

**URL:** <https://discourse.julialang.org/t/lstm-method-error-time-series/73973>\
**Category:** Machine Learning\
**Tags:** question, flux, time-series, machine-learning\
**Created:** [January 3, 2022, 4:01pm UTC](https://discourse.julialang.org/t/lstm-method-error-time-series/73973 "2022-01-03T16:01:36Z")\
**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:** [January 3, 2022, 10:53pm UTC](https://discourse.julialang.org/t/lstm-method-error-time-series/73973/2 "2022-01-03T22:53:08Z")

</div>

All of the type params are obscuring the important part of the MethodError. Here’s what it says with them removed:

```julia-repl
ERROR: LoadError: MethodError: no method matching (::Flux.LSTMCell)(_, ::Float32)

```

So instead of being passed an array, the LSTM is getting individual numbers.

With this, you can work backwards. First, make sure `x` in `eval_model` is an array of arrays as expected by Flux. I’d also rename one of the `x`s in `[model(x) for x in x]` to avoid confusion.

If everything looks good in `eval_model`, then move onto `loss`. Here you’ll want to make sure `x` and `y` are in the correct shape. It may be that `train!` is dividing your input data up in an undesirable way, so if it is I’d recommend using a custom training loop: [Training · Flux](https://fluxml.ai/Flux.jl/stable/training/training/#Custom-Training-loops).

---

_[View the full topic](https://discourse.julialang.org/t/lstm-method-error-time-series/73973)._
