Skip to content

Commit 36a3f70

Browse files
Added support for mutable hash tables and fixed bug in making string constants (#1282)
Signed-off-by: Tom Wildenhain <[email protected]>
1 parent 3c09622 commit 36a3f70

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tf2onnx/graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ def make_const(self, name, np_val, skip_conversion=False, raw=True):
558558
skip_conversion: bool, indicate whether this created node would be mapped during conversion.
559559
raw: whether to store data at field of raw_data or the specific field according to its dtype
560560
"""
561-
if raw:
561+
if raw and np_val.dtype != np.object:
562562
onnx_tensor = numpy_helper.from_array(np_val, name)
563563
else:
564564
onnx_tensor = helper.make_tensor(name, utils.map_numpy_to_onnx_dtype(np_val.dtype),

tf2onnx/tf_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def get_hash_table_info(nodes_or_graph_def):
293293
key_dtypes = []
294294
val_dtypes = []
295295
for n in nodes:
296-
if n.op == "HashTableV2":
296+
if n.op in ["HashTableV2", "MutableHashTableV2"]:
297297
if all(k in n.attr for k in ['shared_name', 'key_dtype', 'value_dtype']):
298298
name = n.attr['shared_name'].s
299299
if name != b'':

0 commit comments

Comments
 (0)