未验证 提交 c6617839 编写于 作者: W Wilber 提交者: GitHub

fix decoding error when clip grad op and python==2 (#33937)

上级 00c85a74
......@@ -20,6 +20,7 @@ import os
import sys
import re
import glob
import io
def find_type_files(cur_dir, file_type, file_list=[]):
......@@ -124,7 +125,7 @@ if __name__ == '__main__':
custom_pattern2 = custom_pattern2[:-1]
all_matches = []
with open(op_file, 'r', encoding='utf-8') as f:
with io.open(op_file, 'r', encoding='utf-8') as f:
content = ''.join(f.readlines())
op, op_count = remove_grad_op_and_kernel(content, op_pattern1,
......@@ -157,8 +158,8 @@ if __name__ == '__main__':
for i in all_matches:
content = content.replace(i, '')
with open(op_file, 'w') as f:
f.write(content)
with io.open(op_file, 'w', encoding='utf-8') as f:
f.write(u'{}'.format(content))
# 2. update operators/CMakeLists.txt
cmake_file = os.path.join(tool_dir,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册