title: Keras network fit: loss is 'nan', accuracy doesn't change
body: <p>I try to fit keras network, but in each epoch loss is 'nan' and accuracy doesn't change... I tried to change epoch, layers count, neurons count, learning rate, optimizers, I checked nan data in datasets, normalize data by different ways, but problem was not solved. Thanks for your help.</p>
  
  <pre class="lang-py prettyprint-override"><code>np.random.seed(1337)
  
  # example of input vector: [-1.459746, 0.2694708, ... 0.90043]
  # example of output vector: [1, 0] or [0, 1]
  
  model = Sequential()
  model.add(Dense(1000, activation='tanh', init='normal', input_dim=503))
  model.add(Dense(2, init='normal', activation='softmax'))
  
  opt = optimizers.sgd(lr=0.01)
  model.compile(loss="categorical_crossentropy", optimizer=opt, metrics=['accuracy'])
  
  print(model.summary())
  
  model.fit(x_train, y_train, batch_size=1000, nb_epoch=100, verbose=1)
  </code></pre>
  
  <pre><code>99804/99804 [==============================] - 5s 52us/step - loss: nan - acc: 0.4938
  Epoch 1/100
  99804/99804 [==============================] - 5s 49us/step - loss: nan - acc: 0.4938
  Epoch 2/100
  99804/99804 [==============================] - 5s 51us/step - loss: nan - acc: 0.4938
  Epoch 3/100
  99804/99804 [==============================] - 5s 52us/step - loss: nan - acc: 0.4938
  Epoch 4/100
  99804/99804 [==============================] - 5s 52us/step - loss: nan - acc: 0.4938
  Epoch 5/100
  99804/99804 [==============================] - 5s 51us/step - loss: nan - acc: 0.4938
  ...
  </code></pre>