@@ -71,6 +71,8 @@ def get_args():
71
71
parser .add_argument ("--custom-ops" , help = "comma-separated map of custom ops to domains in format OpName:domain" )
72
72
parser .add_argument ("--extra_opset" , default = None ,
73
73
help = "extra opset with format like domain:version, e.g. com.microsoft:1" )
74
+ parser .add_argument ("--load_op_libraries" ,
75
+ help = "comma-separated list of tf op library paths to register before loading model" )
74
76
parser .add_argument ("--target" , default = "," .join (constants .DEFAULT_TARGET ), choices = constants .POSSIBLE_TARGETS ,
75
77
help = "target platform" )
76
78
parser .add_argument ("--continue_on_error" , help = "continue_on_error" , action = "store_true" )
@@ -119,7 +121,8 @@ def get_args():
119
121
if len (tokens ) != 2 :
120
122
parser .error ("invalid extra_opset argument" )
121
123
args .extra_opset = [utils .make_opsetid (tokens [0 ], int (tokens [1 ]))]
122
-
124
+ if args .load_op_libraries :
125
+ args .load_op_libraries = args .load_op_libraries .split ("," )
123
126
return args
124
127
125
128
@@ -197,6 +200,9 @@ def main():
197
200
outputs = None
198
201
model_path = None
199
202
203
+ if args .load_op_libraries :
204
+ for op_path in args .load_op_libraries :
205
+ tf .load_op_library (op_path )
200
206
if args .graphdef :
201
207
graph_def , inputs , outputs = tf_loader .from_graphdef (args .graphdef , args .inputs , args .outputs )
202
208
model_path = args .graphdef
0 commit comments