Created
October 24, 2022 18:04
-
-
Save daniil-lyakhov/55fe7dfdbedf00c9778457ed8871ca14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Openvino==2022.2.0 | |
import sys | |
import numpy as np | |
from openvino.runtime import Core | |
if len(sys.argv) < 3: | |
print("Please provide path to model xml file as a first arg and" | |
" path to output text file to dump model constants.") | |
exit() | |
ie = Core() | |
lim = 30. | |
model = ie.read_model(model=sys.argv[1]) | |
with open(sys.argv[2], 'w') as out: | |
for op in model.get_ordered_ops(): | |
if 'fakequantize' in str(op.get_type_info()).lower(): | |
inp_vectors = [op.input_value(i).get_node().get_vector() for i in range(1, 5)] | |
cond = any(np.any(np.abs(x) > lim) for x in inp_vectors) | |
if cond: | |
out.write(op.get_friendly_name() + '\n') | |
print('Done!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment