@tf_test_util.run_in_graph_and_eager_modes()
def test_metrics_correctness(self):
    model = keras.Sequential()
    model.add(keras.layers.Dense(3, activation='relu', input_dim=4, kernel_initializer='ones'))
    model.add(keras.layers.Dense(1, activation='sigmoid', kernel_initializer='ones'))
    model.compile(loss='mae', metrics=['acc'], optimizer=RMSPropOptimizer(learning_rate=0.001))
    x = np.ones((100, 4))
    y = np.ones((100, 1))
    outs = model.evaluate(x, y)
    self.assertEqual(outs[1], 1.0)
    y = np.zeros((100, 1))
    outs = model.evaluate(x, y)
    self.assertEqual(outs[1], 0.0)
@tf_test_util.run_in_graph_and_eager_modes()
def test_metrics_correctness(self):
    model = keras.Sequential()
    model.add(keras.layers.Dense(3, activation='relu', input_dim=4, kernel_initializer='ones'))
    model.add(keras.layers.Dense(1, activation='sigmoid', kernel_initializer='ones'))
    model.compile(loss='mae', metrics=['acc'], optimizer=RMSPropOptimizer(learning_rate=0.001))
    x = np.ones((100, 4))
    y = np.ones((100, 1))
    outs = model.evaluate(x, y)
    self.assertEqual(outs[1], 1.0)
    y = np.zeros((100, 1))
    outs = model.evaluate(x, y)
    self.assertEqual(outs[1], 0.0)