title: how to deal with keras: erro:slice index 0 of dimension 0 out of bounds
body: <p>I use keras(tensorflow backend) to build my lstm network,this is my code:</p>
  
  
  
  <pre class="lang-python prettyprint-override"><code>from keras.models import Sequential,Model
  from keras.layers import LSTM,Conv1D,Dense,MaxPooling1D,GlobalMaxPooling1D,Input,Concatenate
  from keras.optimizers import Adam
  
  x_input = Input(shape=(None,x_train.shape[-1]),name='input')
  x_mid = Conv1D(32,4, activation='relu')(x_input)
  x_mid = MaxPooling1D(3)(x_mid)
  x_mid = Conv1D(32,4,activation = 'relu')(x_mid)
  x_mid = LSTM(32,dropout=0.1, recurrent_dropout=0.2,activation='relu')(x_mid)
  x_mid = Dense(1,activation='sigmoid')(x_mid)
  other_input = Input(shape=(x_blend_train.shape[-1],),name='clfs_input')
  merge_x = concatenate(inputs= [x_mid,other_input],axis = -1)
  output = Dense(32,activation='relu')(merge_x)
  output = Dense(1,activation='sigmoid')(output)
  model = Model(inputs=[x_input,other_input],outputs=output)
  model.compile(optimizer='adam',loss=['binary_crossentropy'],metrics=['acc'])
  model.summary()
  </code></pre>
  
  <p>This is what my network looks like</p>
  
  <pre class="lang-python prettyprint-override"><code>Layer (type)                    Output Shape         Param #     Connected to                     
  ==================================================================================================
  input (InputLayer)              (None, None, 49)     0                                            
  __________________________________________________________________________________________________
  conv1d_56 (Conv1D)              (None, None, 32)     6304        input[0][0]                      
  __________________________________________________________________________________________________
  max_pooling1d_26 (MaxPooling1D) (None, None, 32)     0           conv1d_56[0][0]                  
  __________________________________________________________________________________________________
  conv1d_57 (Conv1D)              (None, None, 32)     4128        max_pooling1d_26[0][0]           
  __________________________________________________________________________________________________
  lstm_26 (LSTM)                  (None, 32)           8320        conv1d_57[0][0]                  
  __________________________________________________________________________________________________
  dense_59 (Dense)                (None, 1)            33          lstm_26[0][0]                    
  __________________________________________________________________________________________________
  clfs_input (InputLayer)         (None, 1)            0                                            
  __________________________________________________________________________________________________
  concatenate_20 (Concatenate)    (None, 2)            0           dense_59[0][0]                   
                                                                   clfs_input[0][0]                 
  __________________________________________________________________________________________________
  dense_60 (Dense)                (None, 32)           96          concatenate_20[0][0]             
  __________________________________________________________________________________________________
  dense_61 (Dense)                (None, 1)            33          dense_60[0][0]                   
  ==================================================================================================
  </code></pre>
  
  <p>my data shape is:</p>
  
  <pre class="lang-python prettyprint-override"><code>x_train.shape: (1350, 14, 49) x_blend_train.shape: (1350, 1) y_train.shape: (1350, 1)
  </code></pre>
  
  <p>my tensorflow and keras version are:</p>
  
  <pre class="lang-python prettyprint-override"><code>tensorflow version:'1.8.0-rc1' keras version:'2.1.6'
  </code></pre>
  
  <p>when I use </p>
  
  <pre class="lang-python prettyprint-override"><code>model.fit( x={'input':x_train,'clfs_input':x_blend_train}, y=y_train, batch_size=64, epochs=10)
  </code></pre>
  
  <p>the computer  return a error to me:</p>
  
  <pre class="lang-python prettyprint-override"><code>InvalidArgumentError: slice index 0 of dimension 0 out of bounds.
       [[Node: lstm_25/strided_slice_13 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=0, ellipsis_mask=0, end_mask=0, new_axis_mask=0, shrink_axis_mask=1, _device="/job:localhost/replica:0/task:0/device:CPU:0"](lstm_25/transpose, loss_11/dense_58_loss/Const_2, lstm_25/strided_slice_9/stack_2, lstm_25/strided_slice_9/stack_2)]]
  </code></pre>
  
  <p>and more detail about error:</p>
  
  <pre class="lang-python prettyprint-override"><code>Epoch 1/10
  ---------------------------------------------------------------------------
  InvalidArgumentError                      Traceback (most recent call last)
  /opt/conda/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
     1321     try:
  -&gt; 1322       return fn(*args)
     1323     except errors.OpError as e:
  
  /opt/conda/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata)
     1306       return self._call_tf_sessionrun(
  -&gt; 1307           options, feed_dict, fetch_list, target_list, run_metadata)
     1308 
  
  /opt/conda/lib/python3.6/site-packages/tensorflow/python/client/session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata)
     1408           self._session, options, feed_dict, fetch_list, target_list,
  -&gt; 1409           run_metadata)
     1410     else:
  
  InvalidArgumentError: slice index 0 of dimension 0 out of bounds.
       [[Node: lstm_25/strided_slice_13 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=0, ellipsis_mask=0, end_mask=0, new_axis_mask=0, shrink_axis_mask=1, _device="/job:localhost/replica:0/task:0/device:CPU:0"](lstm_25/transpose, loss_11/dense_58_loss/Const_2, lstm_25/strided_slice_9/stack_2, lstm_25/strided_slice_9/stack_2)]]
  
  During handling of the above exception, another exception occurred:
  
  InvalidArgumentError                      Traceback (most recent call last)
  &lt;ipython-input-66-c2316b8cd20c&gt; in &lt;module&gt;()
  ----&gt; 1 model.fit( x={'input':x_train,'clfs_input':x_blend_train}, y=y_train, batch_size=64, epochs=10)
        2 y_pred = model.predict({'input':x_train,'clfs_input':x_blend_test})
  
  /opt/conda/lib/python3.6/site-packages/Keras-2.1.6-py3.6.egg/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, **kwargs)
     1031                                         initial_epoch=initial_epoch,
     1032                                         steps_per_epoch=steps_per_epoch,
  -&gt; 1033                                         validation_steps=validation_steps)
     1034 
     1035     def evaluate(self, x=None, y=None,
  
  /opt/conda/lib/python3.6/site-packages/Keras-2.1.6-py3.6.egg/keras/engine/training_arrays.py in fit_loop(model, f, ins, out_labels, batch_size, epochs, verbose, callbacks, val_f, val_ins, shuffle, callback_metrics, initial_epoch, steps_per_epoch, validation_steps)
      193                     ins_batch[i] = ins_batch[i].toarray()
      194 
  --&gt; 195                 outs = f(ins_batch)
      196                 if not isinstance(outs, list):
      197                     outs = [outs]
  
  /opt/conda/lib/python3.6/site-packages/Keras-2.1.6-py3.6.egg/keras/backend/tensorflow_backend.py in __call__(self, inputs)
     2489         session = get_session()
     2490         updated = session.run(fetches=fetches, feed_dict=feed_dict,
  -&gt; 2491                               **self.session_kwargs)
     2492         return updated[:len(self.outputs)]
     2493 
  
  /opt/conda/lib/python3.6/site-packages/tensorflow/python/client/session.py in run(self, fetches, feed_dict, options, run_metadata)
      898     try:
      899       result = self._run(None, fetches, feed_dict, options_ptr,
  --&gt; 900                          run_metadata_ptr)
      901       if run_metadata:
      902         proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)
  
  /opt/conda/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
     1133     if final_fetches or final_targets or (handle and feed_dict_tensor):
     1134       results = self._do_run(handle, final_targets, final_fetches,
  -&gt; 1135                              feed_dict_tensor, options, run_metadata)
     1136     else:
     1137       results = []
  
  /opt/conda/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
     1314     if handle is None:
     1315       return self._do_call(_run_fn, feeds, fetches, targets, options,
  -&gt; 1316                            run_metadata)
     1317     else:
     1318       return self._do_call(_prun_fn, handle, feeds, fetches)
  
  /opt/conda/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
     1333         except KeyError:
     1334           pass
  -&gt; 1335       raise type(e)(node_def, op, message)
     1336 
     1337   def _extend_graph(self):
  </code></pre>
  
  <p>I don't know how to deal with this erro and I try to use google to find answer and look issue in github, but I did't find something can help me. I look forward to your help.</p>