Same (?) neural network architecture in Tensorflow and Keras produces different accuracy on the same data Same (?) neural network architecture in Tensorflow and Keras produces different accuracy on the same data python-3.x python-3.x

Same (?) neural network architecture in Tensorflow and Keras produces different accuracy on the same data


There is an important difference between Keras and TensorFlow regarding dropout:

  • In TensorFlow, the argument keep_prob of tf.nn.dropout sets the probability of keeping a unit.
  • In Keras, the argument rate of keras.layers.Dropout sets the probability of dropping a unit.

In your implementation you're setting the same value to both arguments. You should ensure that keep_prob = 1 - rate.