Skip to content
GitLab
菜单
项目
群组
代码片段
帮助
帮助
支持
社区论坛
快捷键
?
提交反馈
登录/注册
切换导航
菜单
打开侧边栏
KMSCAKKSCFKA AKFACAMADCAS
tensorflow-federated
提交
fd0c3c74
提交
fd0c3c74
编辑于
12月 03, 2020
作者:
Keith Rush
提交者:
tensorflow-copybara
12月 03, 2020
浏览文件
Mitigates NaN not comparing equal in graphdefs by using SerializeToString.
PiperOrigin-RevId: 345598223
上级
dc585975
变更
2
Hide whitespace changes
Inline
Side-by-side
tensorflow_federated/python/core/impl/compiler/tree_analysis.py
浏览文件 @
fd0c3c74
...
...
@@ -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
):
...
...
tensorflow_federated/python/core/impl/compiler/tree_analysis_test.py
浏览文件 @
fd0c3c74
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录