bugfix: recursive layers, merge_test.py reproduces bug (#5972) (#6034)

* merge_test.py reproduces bug (#5972)

* Create copy of inputs if list

* merge_test.py axis order fix + pep8 fix
This commit is contained in:
Andrew Hundt 2017-03-29 12:40:05 -04:00 committed by François Chollet
parent b64e591971
commit b9fc5625fe

@ -107,6 +107,20 @@ def test_merge_concatenate():
assert out.shape == (2, 8, 5) assert out.shape == (2, 8, 5)
assert_allclose(out, np.concatenate([x1, x2], axis=1), atol=1e-4) assert_allclose(out, np.concatenate([x1, x2], axis=1), atol=1e-4)
x3 = np.random.random((1, 1, 1))
nb_layers = 4
x_i = layers.Input(shape=(None, None))
x_list = [x_i]
x = x_i
for i in range(nb_layers):
x_list.append(x)
x = layers.concatenate(x_list, axis=1)
concat_model = models.Model(x_i, x)
concat_out = concat_model.predict([x3])
x3 = np.repeat(x3, 16, axis=1)
assert concat_out.shape == (1, 16, 1)
assert_allclose(concat_out, x3)
@keras_test @keras_test
def test_merge_dot(): def test_merge_dot():