Skip to content

Commit 18ebae1

Browse files
hwangdeyufatcat-z
andauthored
Add the absolute path condition when loads the tf custom op library (#1909)
* fix the absolute path condition when load the tf custom op library Signed-off-by: Deyu Huang <[email protected]> * remove unuse comments Signed-off-by: Deyu Huang <[email protected]> Co-authored-by: Jay Zhang <[email protected]>
1 parent 07e9e0f commit 18ebae1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tf2onnx/convert.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,11 @@ def main():
220220
"See https://github.com/onnx/tensorflow-onnx/issues/1557")
221221

222222
if args.load_op_libraries:
223-
for op_path in args.load_op_libraries:
224-
tf.load_op_library(op_path)
223+
for op_filepath in args.load_op_libraries:
224+
# change relative path to absolute path to satisfy the tf.load_op_library().
225+
if not os.path.isabs(op_filepath):
226+
op_filepath = os.getcwd() + "/" + op_filepath
227+
tf.load_op_library(op_filepath)
225228
if args.graphdef:
226229
graph_def, inputs, outputs = tf_loader.from_graphdef(args.graphdef, args.inputs, args.outputs)
227230
model_path = args.graphdef

0 commit comments

Comments
 (0)