|
15 | 15 | from keras.src.models import Functional
|
16 | 16 | from keras.src.models import Model
|
17 | 17 | from keras.src.models import Sequential
|
| 18 | +from keras.src import ops |
18 | 19 |
|
19 | 20 |
|
20 | 21 | class FunctionalTest(testing.TestCase):
|
@@ -573,7 +574,6 @@ def is_input_warning(w):
|
573 | 574 | with pytest.warns() as warning_logs:
|
574 | 575 | model.predict([np.ones((2, 2)), np.zeros((2, 2))], verbose=0)
|
575 | 576 | self.assertLen(list(filter(is_input_warning, warning_logs)), 1)
|
576 |
| - |
577 | 577 | # No warning for mismatched tuples and lists.
|
578 | 578 | model = Model([i1, i2], outputs)
|
579 | 579 | with warnings.catch_warnings(record=True) as warning_logs:
|
@@ -699,3 +699,17 @@ def test_dict_input_to_list_model(self):
|
699 | 699 | "tags": tags_data,
|
700 | 700 | }
|
701 | 701 | )
|
| 702 | + |
| 703 | + def test_list_input_with_dict_build(self): |
| 704 | + x1 = Input((10,), name="IT") |
| 705 | + x2 = Input((10,), name="IS") |
| 706 | + y = layers.subtract([x1, x2]) |
| 707 | + model = Model(inputs={"IT": x1, "IS": x2}, outputs=y) |
| 708 | + x1 = ops.ones((1, 10)) |
| 709 | + x2 = ops.zeros((1, 10)) |
| 710 | + r1 = model({"IT": x1, "IS": x2}) |
| 711 | + with self.assertRaisesRegex( |
| 712 | + ValueError, |
| 713 | + "The structure of `inputs` doesn't match the expected structure", |
| 714 | + ): |
| 715 | + r2 = model([x1, x2]) |
0 commit comments