# Help with training model on TMVA::DNN

**URL:** <https://root-forum.cern.ch/t/help-with-training-model-on-tmva-dnn/33213>\
**Category:** TMVA\
**Created:** [March 18, 2019, 5:20pm UTC](https://root-forum.cern.ch/t/help-with-training-model-on-tmva-dnn/33213 "2019-03-18T17:20:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![glitch401](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/g/c67d28/32.png) [@glitch401](https://root-forum.cern.ch/u/glitch401)\
**Post date:** [March 18, 2019, 5:20pm UTC](https://root-forum.cern.ch/t/help-with-training-model-on-tmva-dnn/33213/1 "2019-03-18T17:20:57Z")

</div>

Greetings ,  
I was trying to interpret the following python code using TMVA::DNN

Python Code :  
model.add(LSTM(250,input\_shape=(7,1)))  
model.add(Dense(1))  
model.compile(optimizer=‘adam’,loss=‘mse’)

Using TMVA::DNN  
“Layout=RNN|250|7|1,RESHAPE|12182|7|1,DENSE|1|TANH,LINEAR”

As far as I learned from the search results ,  
But unfortunately , on running it on root I get :  
terminate called after throwing an instance of ‘std::bad\_alloc’  
what(): std::bad\_alloc

Please help !

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [March 25, 2019, 4:22pm UTC](https://root-forum.cern.ch/t/help-with-training-model-on-tmva-dnn/33213/2 "2019-03-25T16:22:49Z")

</div>

Hi,

I think you have some inconsistencies in your layer specification. An RNN with 250 units/neurons and 7 time outputs does not result in a 12182 by 7 output vector.

Cheers,  
Kim
