Skip to content
Merged
Changes from 3 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
9 changes: 6 additions & 3 deletions onnxscript/backend/onnx_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@

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,8 +394,8 @@
attributes.append((at.name, at.ref_attr_name))
continue
value = _attribute_value(at)
if isinstance(value, str):
attributes.append((at.name, f"{value!r}"))
if isinstance(value, str, bytes):
attributes.append((at.name, repr(value)))
continue
if isinstance(value, np.ndarray):
onnx_dtype = at.t.data_type
Expand Down
Loading