зеркало из https://github.com/microsoft/hat.git
Makes output from `hatlib.verify_hat` easier to read (#45)
This commit is contained in:
Родитель
9cb567a1f6
Коммит
ce2fb0b133
|
@ -9,21 +9,34 @@ def verify_hat_package(hat_path):
|
|||
_, funcs = hat.load(hat_path)
|
||||
inputs = hat.generate_input_sets_for_hat_file(hat_path)
|
||||
for name, fn in funcs.items():
|
||||
print(f"Verifying function {name} --")
|
||||
print(f"\n{'*' * 10}\n")
|
||||
|
||||
print(f"[*] Verifying function {name} --")
|
||||
func_inputs = inputs[name]
|
||||
|
||||
print("Inputs before function call:")
|
||||
print("[*] Inputs before function call:")
|
||||
for i, func_input in enumerate(func_inputs):
|
||||
print(f"\tInput {i}: {','.join(map(str, func_input.ravel()[:32]))}")
|
||||
print(f"[*]\tInput {i}: {','.join(map(str, func_input.ravel()[:32]))}")
|
||||
|
||||
time = fn(*inputs[name])
|
||||
try:
|
||||
|
||||
time = fn(*inputs[name])
|
||||
|
||||
except RuntimeError as e:
|
||||
print(f"[!] Error while running {name}: {e}")
|
||||
continue
|
||||
|
||||
print("Inputs after function call:")
|
||||
for i, func_input in enumerate(func_inputs):
|
||||
print(f"\tInput {i}: {','.join(map(str, func_input.ravel()[:32]))}")
|
||||
print(f"[*]\tInput {i}: {','.join(map(str, func_input.ravel()[:32]))}")
|
||||
|
||||
if time:
|
||||
print(f"Function execution time: {time:4f}ms")
|
||||
print(f"[*] Function execution time: {time:4f}ms")
|
||||
|
||||
del inputs[name]
|
||||
|
||||
else:
|
||||
print(f"\n{'*' * 10}\n")
|
||||
|
||||
|
||||
def main():
|
||||
|
|
Загрузка…
Ссылка в новой задаче