未验证 提交 92adeceb 编写于 作者: T tianshuo78520a 提交者: GitHub

make check_op_desc.py support python3 (#32807)

上级 23ab01e3
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
import json import json
import sys import sys
import operator
from paddle.utils import OpLastCheckpointChecker from paddle.utils import OpLastCheckpointChecker
from paddle.fluid.core import OpUpdateType from paddle.fluid.core import OpUpdateType
...@@ -71,7 +72,8 @@ def diff_vars(origin_vars, new_vars): ...@@ -71,7 +72,8 @@ def diff_vars(origin_vars, new_vars):
vars_name_only_in_new = set(new_vars.keys()) - set(origin_vars.keys()) vars_name_only_in_new = set(new_vars.keys()) - set(origin_vars.keys())
for var_name in common_vars_name: for var_name in common_vars_name:
if cmp(origin_vars.get(var_name), new_vars.get(var_name)) == SAME: if operator.eq(origin_vars.get(var_name),
new_vars.get(var_name)) == SAME:
continue continue
else: else:
error, var_error = True, True error, var_error = True, True
...@@ -120,7 +122,8 @@ def diff_attr(ori_attrs, new_attrs): ...@@ -120,7 +122,8 @@ def diff_attr(ori_attrs, new_attrs):
attrs_only_in_new = set(new_attrs.keys()) - set(ori_attrs.keys()) attrs_only_in_new = set(new_attrs.keys()) - set(ori_attrs.keys())
for attr_name in common_attrs: for attr_name in common_attrs:
if cmp(ori_attrs.get(attr_name), new_attrs.get(attr_name)) == SAME: if operator.eq(ori_attrs.get(attr_name),
new_attrs.get(attr_name)) == SAME:
continue continue
else: else:
error, attr_error = True, True error, attr_error = True, True
...@@ -184,7 +187,7 @@ def compare_op_desc(origin_op_desc, new_op_desc): ...@@ -184,7 +187,7 @@ def compare_op_desc(origin_op_desc, new_op_desc):
new = json.loads(new_op_desc) new = json.loads(new_op_desc)
desc_error_message = {} desc_error_message = {}
version_error_message = {} version_error_message = {}
if cmp(origin_op_desc, new_op_desc) == SAME: if operator.eq(origin_op_desc, new_op_desc) == SAME:
return desc_error_message, version_error_message return desc_error_message, version_error_message
for op_type in origin: for op_type in origin:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册