From 6907c12d827b6c8431cd757bfc3fc81bb2abc532 Mon Sep 17 00:00:00 2001
From: Yaman Umuroglu <maltanar@gmail.com>
Date: Tue, 3 Dec 2019 00:21:35 +0000
Subject: [PATCH] [CustomOp] encode string attributes correctly

---
 src/finn/custom_op/__init__.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/finn/custom_op/__init__.py b/src/finn/custom_op/__init__.py
index fdbd7a17f..519d48e97 100644
--- a/src/finn/custom_op/__init__.py
+++ b/src/finn/custom_op/__init__.py
@@ -38,6 +38,9 @@ class CustomOp(ABC):
             if attr is not None:
                 # dtype indicates which ONNX Attribute member to use
                 # (such as i, f, s...)
+                if dtype == "s":
+                    # encode string attributes
+                    value = value.encode("utf-8")
                 attr.__setattr__(dtype, value)
             else:
                 # not set, create and insert AttributeProto
-- 
GitLab