Skip to content

Commit be2ccaf

Browse files
Merge pull request #969 from onnx/rashuai/UnifyConst
UnifyConst
2 parents 9c8e9e1 + d3be284 commit be2ccaf

File tree

2 files changed

+88
-121
lines changed

2 files changed

+88
-121
lines changed

tf2onnx/graph.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,14 @@ def inputs(self):
484484
all_inputs.append(n)
485485
return all_inputs
486486

487+
def make_consts(self, values, np_type=np.int64, skip_conversion=False, raw=True):
488+
"""create list of consts of same type"""
489+
consts = []
490+
for value in values:
491+
np_val = np.array(value).astype(np_type)
492+
consts.append(self.make_const(utils.make_name("const"), np_val, skip_conversion, raw))
493+
return consts
494+
487495
def make_const(self, name, np_val, skip_conversion=False, raw=True):
488496
"""Make a new constant in the graph.
489497
Args:

0 commit comments

Comments
 (0)