Query caffe2 operator stats for detailed execution info (#20924)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/20924
I found a python3 bug for deserializing caffe2 code. The exception thrown is Unicode related error instead of just decode error, and we need to catch that as well
Reviewed By: ipiszy
Differential Revision: D15293221
fbshipit-source-id: 29820800d1b4cbe5bf3f5a189fe2023e655d0508
diff --git a/caffe2/python/utils.py b/caffe2/python/utils.py
index d5c6355..c1dcb88 100644
--- a/caffe2/python/utils.py
+++ b/caffe2/python/utils.py
@@ -205,7 +205,7 @@
try:
text_format.Parse(s, obj)
return obj
- except text_format.ParseError:
+ except (text_format.ParseError, UnicodeDecodeError):
obj.ParseFromString(s)
return obj