Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions onnxscript/backend/onnx_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ def _translate_value_info(value_info: ValueInfoProto) -> str:

def _to_str(s):
if isinstance(s, bytes):
return s.decode("utf-8")
try:
return s.decode("utf-8")
except UnicodeDecodeError:
pass
return s


Expand Down Expand Up @@ -391,7 +394,7 @@ def _translate_attributes(self, node):
attributes.append((at.name, at.ref_attr_name))
continue
value = _attribute_value(at)
if isinstance(value, str):
if isinstance(value, str, bytes):
attributes.append((at.name, f"{value!r}"))
continue
if isinstance(value, np.ndarray):
Expand Down
Loading