From a5251fbd1472cfcc61b6d4787be874234ee44958 Mon Sep 17 00:00:00 2001 From: Adrian RC Date: Wed, 25 Sep 2024 00:47:34 +0000 Subject: [PATCH] Update and uncomment keras util tests --- tensorboard/plugins/graph/keras_util_test.py | 92 +++++--------------- 1 file changed, 22 insertions(+), 70 deletions(-) diff --git a/tensorboard/plugins/graph/keras_util_test.py b/tensorboard/plugins/graph/keras_util_test.py index 13f86e6a08..a25c2b8f03 100644 --- a/tensorboard/plugins/graph/keras_util_test.py +++ b/tensorboard/plugins/graph/keras_util_test.py @@ -36,10 +36,10 @@ def assertGraphDefToModel(self, expected_proto, model): expected_proto, keras_util.keras_model_to_graph_def(model_config) ) - def DISABLED_test_keras_model_to_graph_def_sequential_model(self): + def test_keras_model_to_graph_def_sequential_model(self): expected_proto = """ node { - name: "sequential/dense_input" + name: "sequential/input_layer" attr { key: "dtype" value { @@ -55,7 +55,7 @@ def DISABLED_test_keras_model_to_graph_def_sequential_model(self): } node { name: "sequential/dense" - input: "sequential/dense_input" + input: "sequential/input_layer" attr { key: "dtype" value { @@ -323,42 +323,10 @@ def test_keras_model_to_graph_def_lstm_model(self): ) self.assertGraphDefToModel(expected_proto, model) - def DISABLED_test_keras_model_to_graph_def_nested_sequential_model(self): + def test_keras_model_to_graph_def_nested_sequential_model(self): expected_proto = """ node { - name: "sequential_2/sequential_1_input" - attr { - key: "dtype" - value { - type: DT_FLOAT - } - } - attr { - key: "keras_class" - value { - s: "InputLayer" - } - } - } - node { - name: "sequential_2/sequential_1/sequential_input" - input: "sequential_2/sequential_1_input" - attr { - key: "dtype" - value { - type: DT_FLOAT - } - } - attr { - key: "keras_class" - value { - s: "InputLayer" - } - } - } - node { - name: "sequential_2/sequential_1/sequential/dense_input" - input: "sequential_2/sequential_1/sequential_input" + name: "sequential_2/sequential_1/sequential/input_layer" attr { key: "dtype" value { @@ -374,7 +342,7 @@ def DISABLED_test_keras_model_to_graph_def_nested_sequential_model(self): } node { name: "sequential_2/sequential_1/sequential/dense" - input: "sequential_2/sequential_1/sequential/dense_input" + input: "sequential_2/sequential_1/sequential/input_layer" attr { key: "dtype" value { @@ -786,12 +754,12 @@ def test_keras_model_to_graph_def_functional_model_as_layer(self): self.assertGraphDefToModel(expected_proto, model) - def DISABLED_test_keras_model_to_graph_def_functional_sequential_model( + def test_keras_model_to_graph_def_functional_sequential_model( self, ): expected_proto = """ node { - name: "model/func_seq_input" + name: "functional_1/func_seq_input" attr { key: "dtype" value { @@ -806,8 +774,8 @@ def DISABLED_test_keras_model_to_graph_def_functional_sequential_model( } } node { - name: "model/sequential/dense_input" - input: "model/func_seq_input" + name: "functional_1/sequential/input_layer" + input: "functional_1/func_seq_input" attr { key: "dtype" value { @@ -822,8 +790,8 @@ def DISABLED_test_keras_model_to_graph_def_functional_sequential_model( } } node { - name: "model/sequential/dense" - input: "model/sequential/dense_input" + name: "functional_1/sequential/dense" + input: "functional_1/sequential/input_layer" attr { key: "dtype" value { @@ -838,8 +806,8 @@ def DISABLED_test_keras_model_to_graph_def_functional_sequential_model( } } node { - name: "model/sequential/my_relu" - input: "model/sequential/dense" + name: "functional_1/sequential/my_relu" + input: "functional_1/sequential/dense" attr { key: "dtype" value { @@ -854,8 +822,8 @@ def DISABLED_test_keras_model_to_graph_def_functional_sequential_model( } } node { - name: "model/dense_1" - input: "model/sequential/my_relu" + name: "functional_1/dense_1" + input: "functional_1/sequential/my_relu" attr { key: "dtype" value { @@ -885,27 +853,12 @@ def DISABLED_test_keras_model_to_graph_def_functional_sequential_model( self.assertGraphDefToModel(expected_proto, model) - def DISABLED_test_keras_model_to_graph_def_sequential_functional_model( + def test_keras_model_to_graph_def_sequential_functional_model( self, ): expected_proto = """ node { - name: "sequential/model_input" - attr { - key: "dtype" - value { - type: DT_FLOAT - } - } - attr { - key: "keras_class" - value { - s: "InputLayer" - } - } - } - node { - name: "sequential/model/func_seq_input" + name: "sequential/functional/func_seq_input" attr { key: "dtype" value { @@ -920,8 +873,8 @@ def DISABLED_test_keras_model_to_graph_def_sequential_functional_model( } } node { - name: "sequential/model/dense" - input: "sequential/model/func_seq_input" + name: "sequential/functional/dense" + input: "sequential/functional/func_seq_input" attr { key: "dtype" value { @@ -937,7 +890,7 @@ def DISABLED_test_keras_model_to_graph_def_sequential_functional_model( } node { name: "sequential/dense_1" - input: "sequential/model/dense" + input: "sequential/functional/dense" attr { key: "dtype" value { @@ -982,8 +935,7 @@ def DISABLED_test_keras_model_to_graph_def_sequential_functional_model( self.assertGraphDefToModel(expected_proto, model) - # Enable after next sync to internal repo from Keras team. - def DISABLED_test_keras_model_to_graph_def_functional_multiple_inbound_nodes_from_same_node( + def test_keras_model_to_graph_def_functional_multiple_inbound_nodes_from_same_node( self, ): expected_proto = """