# Shape length error with Convolutional LSTM

**URL:** <https://community.konduit.ai/t/shape-length-error-with-convolutional-lstm/1427>\
**Category:** DL4J\
**Created:** [June 6, 2021, 6:34pm UTC](https://community.konduit.ai/t/shape-length-error-with-convolutional-lstm/1427 "2021-06-06T18:34:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![KingCarter](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@KingCarter](https://community.konduit.ai/u/KingCarter)\
**Post date:** [June 6, 2021, 6:34pm UTC](https://community.konduit.ai/t/shape-length-error-with-convolutional-lstm/1427/1 "2021-06-06T18:34:45Z")

</div>

Hello all,

I am new to machine learning and have tried to set up my own financial time series prediction network using the Sea Temperature Convolutional LSTM 2 example from the Deeplearning4j documentation [LSTM Example](https://deeplearning4j.konduit.ai/getting-started/tutorials/sea-temperature-convolutional-lstm-example-2).

I prepared the data exactly as described in the documentation. Feature, target and future data are available. The target data are one data point ahead of the feature data in time. The Future data is 10 data points ahead of the Target data.  
My training data comprises 550 files, each with 7 columns (attributes) and exactly 50 rows (consecutive time points). The Test (Evaluation) and Future data each comprise 48 files with the same named attributes.

But no matter how I configure the network, the same error type always occurs in the net.fit() method.

 ![Config](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/1X/7e7c765ef1fcfb00e3d35fc5c48c5316c80b3444.jpeg)

With exactly the same configuration of the network as in the Sea Temperature Convolutional LSTM 2 example from the documentation (as shown in the image above), the error message looks like this:

“New shape length doesn’t match original length: [44800] vs [11200]. Original shape: [1600, 7] New Shape: [1600, 1, 7, 4]”

I would like to understand what is the reason for this.  
I’m sorry that I can’t post more images at once as I’m a new user to this forum.

Best regards  
Tristan

---

<div class="post-metadata">

**Author:** ![KingCarter](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@KingCarter](https://community.konduit.ai/u/KingCarter)\
**Post date:** [June 6, 2021, 6:38pm UTC](https://community.konduit.ai/t/shape-length-error-with-convolutional-lstm/1427/2 "2021-06-06T18:38:32Z")

</div>

The .csv files look like this (all containing 50 rows each as I said):

 ![Data_Raw](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/1X/46a21c7862d907d8d0937767c94ac655c9af81fe.jpeg)

---

<div class="post-metadata">

**Author:** ![KingCarter](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@KingCarter](https://community.konduit.ai/u/KingCarter)\
**Post date:** [June 6, 2021, 6:39pm UTC](https://community.konduit.ai/t/shape-length-error-with-convolutional-lstm/1427/3 "2021-06-06T18:39:53Z")

</div>

The data loading and normalization code looks like this:

 ![Data](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/1X/1183bc286a42e0e67392849f5db4bc9c396e0fc2.jpeg)

---

<div class="post-metadata">

**Author:** ![KingCarter](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@KingCarter](https://community.konduit.ai/u/KingCarter)\
**Post date:** [June 6, 2021, 6:41pm UTC](https://community.konduit.ai/t/shape-length-error-with-convolutional-lstm/1427/4 "2021-06-06T18:41:17Z")

</div>

Correction: The Future data is 12 data points ahead of the Target data.

---

<div class="post-metadata">

**Author:** ![giorginus80](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/giorginus80/32/647_2.png) [@giorginus80](https://community.konduit.ai/u/giorginus80)\
**Post date:** [October 11, 2021, 12:06pm UTC](https://community.konduit.ai/t/shape-length-error-with-convolutional-lstm/1427/5 "2021-10-11T12:06:50Z")

</div>

Hello, did you find the solution?

---

<div class="post-metadata">

**Author:** ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)\
**Post date:** [October 11, 2021, 12:48pm UTC](https://community.konduit.ai/t/shape-length-error-with-convolutional-lstm/1427/6 "2021-10-11T12:48:55Z")

</div>

Huh, this seems to have slipped by somehow.

Anyway, the error message tells you exactly what the problem is: There is a reshape happening that tries to turn a [1600, 7] shaped input into a [1600, 1, 7, 4] shaped one.

Without seeing any more of the stack trace, I guess that you RnnToCnnPreProcessor is configured wrong, as that is the only place where that specific target shape may come from given the screenshots you shared.
