def test_evaluate_predict_on_arrays(self):
    a = keras.layers.Input(shape=(3,), name='input_a')
    b = keras.layers.Input(shape=(3,), name='input_b')
    dense = keras.layers.Dense(4, name='dense')
    c = dense(a)
    d = dense(b)
    e = keras.layers.Dropout(0.5, name='dropout')(c)
    model = keras.models.Model([a, b], [d, e])
    optimizer = RMSPropOptimizer(learning_rate=0.001)
    loss = 'mse'
    loss_weights = [1.0, 0.5]
    metrics = ['acc', 'mae']
    model.compile(optimizer, loss, metrics=metrics, loss_weights=loss_weights, sample_weight_mode=None)
    input_a_np = np.random.random((10, 3))
    input_b_np = np.random.random((10, 3))
    output_d_np = np.random.random((10, 4))
    output_e_np = np.random.random((10, 4))
    out = model.evaluate([input_a_np, input_b_np], [output_d_np, output_e_np], batch_size=5, verbose=0)
    self.assertEqual(len(out), 7)
    out = model.evaluate([input_a_np, input_b_np], [output_d_np, output_e_np], batch_size=5, verbose=1)
    self.assertEqual(len(out), 7)
    out = model.evaluate([input_a_np, input_b_np], [output_d_np, output_e_np], batch_size=5, verbose=2)
    self.assertEqual(len(out), 7)
    out = model.test_on_batch([input_a_np, input_b_np], [output_d_np, output_e_np])
    self.assertEqual(len(out), 7)
    model.evaluate({'input_a': input_a_np, 'input_b': input_b_np}, {'dense': output_d_np, 'dropout': output_e_np}, batch_size=5, verbose=0)
    model.evaluate({'input_a': input_a_np, 'input_b': input_b_np}, {'dense': output_d_np, 'dropout': output_e_np}, batch_size=5, verbose=1)
    out = model.predict([input_a_np, input_b_np], batch_size=5)
    self.assertEqual(len(out), 2)
    out = model.predict({'input_a': input_a_np, 'input_b': input_b_np})
    self.assertEqual(len(out), 2)
    out = model.predict_on_batch({'input_a': input_a_np, 'input_b': input_b_np})
    self.assertEqual(len(out), 2)
def test_evaluate_predict_on_arrays(self):
    a = keras.layers.Input(shape=(3,), name='input_a')
    b = keras.layers.Input(shape=(3,), name='input_b')
    dense = keras.layers.Dense(4, name='dense')
    c = dense(a)
    d = dense(b)
    e = keras.layers.Dropout(0.5, name='dropout')(c)
    model = keras.models.Model([a, b], [d, e])
    optimizer = RMSPropOptimizer(learning_rate=0.001)
    loss = 'mse'
    loss_weights = [1.0, 0.5]
    metrics = ['acc', 'mae']
    model.compile(optimizer, loss, metrics=metrics, loss_weights=loss_weights, sample_weight_mode=None)
    input_a_np = np.random.random((10, 3))
    input_b_np = np.random.random((10, 3))
    output_d_np = np.random.random((10, 4))
    output_e_np = np.random.random((10, 4))
    out = model.evaluate([input_a_np, input_b_np], [output_d_np, output_e_np], batch_size=5, verbose=0)
    self.assertEqual(len(out), 7)
    out = model.evaluate([input_a_np, input_b_np], [output_d_np, output_e_np], batch_size=5, verbose=1)
    self.assertEqual(len(out), 7)
    out = model.evaluate([input_a_np, input_b_np], [output_d_np, output_e_np], batch_size=5, verbose=2)
    self.assertEqual(len(out), 7)
    out = model.test_on_batch([input_a_np, input_b_np], [output_d_np, output_e_np])
    self.assertEqual(len(out), 7)
    model.evaluate({'input_a': input_a_np, 'input_b': input_b_np}, {'dense': output_d_np, 'dropout': output_e_np}, batch_size=5, verbose=0)
    model.evaluate({'input_a': input_a_np, 'input_b': input_b_np}, {'dense': output_d_np, 'dropout': output_e_np}, batch_size=5, verbose=1)
    out = model.predict([input_a_np, input_b_np], batch_size=5)
    self.assertEqual(len(out), 2)
    out = model.predict({'input_a': input_a_np, 'input_b': input_b_np})
    self.assertEqual(len(out), 2)
    out = model.predict_on_batch({'input_a': input_a_np, 'input_b': input_b_np})
    self.assertEqual(len(out), 2)