@tf_test_util.run_in_graph_and_eager_modes()
def test_loss_correctness(self):
    model = keras.Sequential()
    model.add(keras.layers.Dense(3, activation='relu', input_dim=4, kernel_initializer='ones'))
    model.add(keras.layers.Dense(2, activation='softmax', kernel_initializer='ones'))
    model.compile(loss='sparse_categorical_crossentropy', optimizer=RMSPropOptimizer(learning_rate=0.001))
    x = np.ones((100, 4))
    np.random.seed(123)
    y = np.random.randint(0, 1, size=(100, 1))
    history = model.fit(x, y, epochs=1, batch_size=10)
    self.assertEqual(np.around(history.history['loss'][(- 1)], decimals=4), 0.6173)
@tf_test_util.run_in_graph_and_eager_modes()
def test_loss_correctness(self):
    model = keras.Sequential()
    model.add(keras.layers.Dense(3, activation='relu', input_dim=4, kernel_initializer='ones'))
    model.add(keras.layers.Dense(2, activation='softmax', kernel_initializer='ones'))
    model.compile(loss='sparse_categorical_crossentropy', optimizer=RMSPropOptimizer(learning_rate=0.001))
    x = np.ones((100, 4))
    np.random.seed(123)
    y = np.random.randint(0, 1, size=(100, 1))
    history = model.fit(x, y, epochs=1, batch_size=10)
    self.assertEqual(np.around(history.history['loss'][(- 1)], decimals=4), 0.6173)