예제 #1
0
    def test_loop_to_scan(self):
        loop_model_filename = get_name("nuphar_tiny_model_with_loop_shape_infered.onnx")
        scan_model_filename = "nuphar_tiny_model_with_loop_shape_infered_converted_to_scan.onnx"
        subprocess.run([
            sys.executable, '-m', 'onnxruntime.nuphar.model_editor',
            '--input', loop_model_filename,
            '--output', scan_model_filename, '--mode', 'loop_to_scan'
        ], check=True)

        validate_with_ort(loop_model_filename, scan_model_filename)
예제 #2
0
    def test_loop_to_scan_tool(self):
        loop_model_filename = get_name("nuphar_tiny_model_with_loop_shape_infered.onnx")
        scan_model_filename = "nuphar_tiny_model_with_loop_shape_infered_converted_to_scan.onnx"
        subprocess.run([
            sys.executable, '-m', 'onnxruntime.nuphar.model_tools',
            '--input', loop_model_filename,
            '--output', scan_model_filename,
            '--tool', 'convert_loop_to_scan_and_validate',
            '--symbolic_dims', 'sequence=30'
        ], check=True)

        validate_with_ort(loop_model_filename, scan_model_filename)
    def test_loop_to_scan(self):
        loop_model_filename = get_name(
            "nuphar_tiny_model_with_loop_shape_infered.onnx")
        scan_model_filename = "nuphar_tiny_model_with_loop_shape_infered_converted_to_scan.onnx"
        subprocess.run(
            [
                sys.executable,
                "-m",
                "onnxruntime.nuphar.model_editor",
                "--input",
                loop_model_filename,
                "--output",
                scan_model_filename,
                "--mode",
                "loop_to_scan",
            ],
            check=True,
        )

        validate_with_ort(loop_model_filename, scan_model_filename)
    def test_loop_to_scan_tool(self):
        loop_model_filename = get_name(
            "nuphar_tiny_model_with_loop_shape_infered.onnx")
        scan_model_filename = "nuphar_tiny_model_with_loop_shape_infered_converted_to_scan.onnx"
        subprocess.run(
            [
                sys.executable,
                "-m",
                "onnxruntime.nuphar.model_tools",
                "--input",
                loop_model_filename,
                "--output",
                scan_model_filename,
                "--tool",
                "convert_loop_to_scan_and_validate",
                "--symbolic_dims",
                "sequence=30",
            ],
            check=True,
        )

        validate_with_ort(loop_model_filename, scan_model_filename)