We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3383ff9 + e0edb23 commit ac395f3Copy full SHA for ac395f3
tf2onnx/tf_utils.py
@@ -57,8 +57,11 @@ def tf_to_onnx_tensor(tensor, name=""):
57
# assume np_data is string, numpy_helper.from_array accepts ndarray,
58
# in which each item is of str while the whole dtype is of object.
59
try:
60
- np_data = np_data.astype(np.str).astype(np.object)
61
- except: # pylint: disable=bare-except
+ if len(np_data.shape) > 0:
+ np_data = np_data.astype(np.str).astype(np.object)
62
+ else:
63
+ np_data = np.array(str(np_data)).astype(np.object)
64
+ except: # pylint: disable=bare-except
65
raise RuntimeError("Not support type: {}".format(type(np_data.flat[0])))
66
return numpy_helper.from_array(np_data, name=name)
67
0 commit comments