systemml-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [systemml] lukas-jkl commented on a change in pull request #904: onnx-systemds implementation
Date Thu, 14 May 2020 12:08:12 GMT

lukas-jkl commented on a change in pull request #904:

File path: src/main/python/onnx_systemds/
@@ -0,0 +1,54 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import argparse
+import os.path
+import ntpath
+import onnx_systemds.onnx_helper as onnx_helper
+import onnx_systemds.render as render
+def init_argparse() -> argparse.ArgumentParser:
+    arg_parser = argparse.ArgumentParser(description="Convert onnx models into dml scripts")
+    arg_parser.add_argument("input", type=str)
+    arg_parser.add_argument("-o", "--output", type=str,
+                            help="output file", required=False)
+    return arg_parser
+def onnx2systemds(input_onnx_file: str, output_dml_file: str = None) -> None:
+    """
+    Loads the model from the input file and generates a dml file.
+    :param input_onnx_file: the onnx input file
+    :param output_dml_file: (optional) the dml output file,
+        if this parameter is not given the output file will have the same name as the input
+    """
+    if not os.path.isfile(input_onnx_file):
+        raise Exception("Invalid input-file: " + str(input_onnx_file))
+    if not output_dml_file:
+        output_dml_file = os.path.splitext(ntpath.basename(input_onnx_file))[0] + ".dml"

Review comment:
       I guess os.path can also be used. I've now removed ntpath.

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:

View raw message