[Python3] Fix flexbuffers custom converter
authorGichan Jang <gichan2.jang@samsung.com>
Mon, 24 May 2021 06:55:04 +0000 (15:55 +0900)
committerSangjung Woo <again4you@gmail.com>
Tue, 1 Jun 2021 08:34:58 +0000 (17:34 +0900)
Fix flexbuffers custom converter script.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
tests/test_models/models/custom_converter.py

index 52fb74a..cf8e960 100644 (file)
@@ -59,12 +59,12 @@ class CustomConverter(object):
     for i in range(num_tensors):
       tensor_key = "tensor_{idx}".format(idx=i)
       tensor = tensors[tensor_key].AsVector
-      dtype = _to_numpy_type (tensor[1].AsInt)
+      ttype = _to_numpy_type (tensor[1].AsInt)
       tdim = tensor[2].AsTypedVector
       dim = []
       for j in range(4):
         dim.append(tdim[j].AsInt)
-      tensors_info.append(nns.TensorShape(dim, np.uint8))
+      tensors_info.append(nns.TensorShape(dim, ttype))
       raw_data.append(np.frombuffer(tensor[3].AsBlob, dtype=np.uint8))
 
     return (tensors_info, raw_data, rate_n, rate_d)