-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquantizer.py
executable file
·24 lines (19 loc) · 987 Bytes
/
quantizer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import subprocess
import argparse
def call_c_program(file1, file2, number):
command = ["./quantizer", "-f", file1, "-g", file2, "-n", str(number)]
try:
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
if result.returncode == 0:
print(result.stdout)
else:
print("Error:", result.stderr)
except FileNotFoundError:
print("Error: The C program executable 'quantizer' was not found.")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Python wrapper for C program")
parser.add_argument("-f", "--file1", required=True, help="Path to input model file")
parser.add_argument("-g", "--file2", required=True, help="Path to output model file")
parser.add_argument("-n", "--number", type=int, required=True, help="Quantization type")
args = parser.parse_args()
call_c_program(args.file1, args.file2, args.number)