提交 fd0c3c74 编辑于 作者: Keith Rush's avatar Keith Rush 提交者: tensorflow-copybara
浏览文件

Mitigates NaN not comparing equal in graphdefs by using SerializeToString.

PiperOrigin-RevId: 345598223
上级 dc585975
......@@ -465,7 +465,13 @@ def _compiled_comp_equal(comp_1, comp_2):
graphdef_1 = serialization_utils.unpack_graph_def(tensorflow_1.graph_def)
graphdef_2 = serialization_utils.unpack_graph_def(tensorflow_2.graph_def)
return graphdef_1 == graphdef_2
# TODO(b/174605105): We prefer to mitigate nans comparing unequal for now,
# given the severity of TFF's failure to handle this violation of its
# assumption that trees_equal is an equivalence relation on its ASTs. But this
# is not a long-term solution. To replace with more legitimate proto
# comparison which treats nans as equal.
return graphdef_1.SerializeToString(
deterministic=True) == graphdef_2.SerializeToString(deterministic=True)
def trees_equal(comp_1, comp_2):
......
......@@ -710,7 +710,6 @@ class TreesEqualTest(absltest.TestCase):
self.assertTrue(tree_analysis.trees_equal(tuple_1, tuple_2))
def test_returns_true_for_identical_graphs_with_nans(self):
self.skipTest('b/174605105')
tf_comp1 = _create_tensorflow_graph_with_nan()
tf_comp2 = _create_tensorflow_graph_with_nan()
self.assertTrue(tree_analysis.trees_equal(tf_comp1, tf_comp2))
......
Supports Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册