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

Adds failing test for TF graph comparison with NaNs.

PiperOrigin-RevId: 345113267
上级 2438f7bc
...@@ -280,6 +280,15 @@ def _create_two_variable_tensorflow(): ...@@ -280,6 +280,15 @@ def _create_two_variable_tensorflow():
return _pack_noarg_graph(g.as_graph_def(), result_type, result_binding) return _pack_noarg_graph(g.as_graph_def(), result_type, result_binding)
def _create_tensorflow_graph_with_nan():
with tf.Graph().as_default() as g:
a = tf.constant(float('NaN'))
result_type, result_binding = tensorflow_utils.capture_result_from_graph(a, g)
return _pack_noarg_graph(g.as_graph_def(), result_type, result_binding)
class CountTensorFlowVariablesTest(absltest.TestCase): class CountTensorFlowVariablesTest(absltest.TestCase):
def test_raises_on_none(self): def test_raises_on_none(self):
...@@ -362,7 +371,7 @@ class ContainsNoUnboundReferencesTest(absltest.TestCase): ...@@ -362,7 +371,7 @@ class ContainsNoUnboundReferencesTest(absltest.TestCase):
self.assertFalse(tree_analysis.contains_no_unbound_references(fn)) self.assertFalse(tree_analysis.contains_no_unbound_references(fn))
class ComputationsEqualTest(absltest.TestCase): class TreesEqualTest(absltest.TestCase):
def test_raises_type_error(self): def test_raises_type_error(self):
data = building_blocks.Data('data', tf.int32) data = building_blocks.Data('data', tf.int32)
...@@ -700,6 +709,12 @@ class ComputationsEqualTest(absltest.TestCase): ...@@ -700,6 +709,12 @@ class ComputationsEqualTest(absltest.TestCase):
tuple_2 = building_blocks.Struct([data_2, data_2]) tuple_2 = building_blocks.Struct([data_2, data_2])
self.assertTrue(tree_analysis.trees_equal(tuple_1, tuple_2)) 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))
@computations.federated_computation @computations.federated_computation
def non_aggregation_intrinsics(): def non_aggregation_intrinsics():
......
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册