Skip to content
Snippets Groups Projects

Draft: Dev ptq

Closed Cyril Moineau requested to merge DevPTQ into master
All threads resolved!
7 files
+ 84
295
Compare changes
  • Side-by-side
  • Inline
Files
7
@@ -2,12 +2,9 @@
import aidge_core
import aidge_backend_cpu
import aidge_onnx
import aidge_quantization
import numpy as np
import matplotlib.pyplot as plt
from jinja2 import Environment, FileSystemLoader
import os
import pathlib
import onnx
model = aidge_onnx.load_onnx("MNIST_model/LeNet_MNIST.onnx")
@@ -29,18 +26,7 @@ input_node.get_operator().set_backend("cpu")
## Link Producer to the Graph
input_node.add_child(model)
nodesRegexes = {}
nodesRegexes["Flatten"] = aidge_core.NodeRegex("Flatten")
# Graph Regex
graphRegex = ["Flatten;"]
graphMatching = aidge_core.GRegex(nodesRegexes, graphRegex)
all_match = graphMatching.match(model)
print('Number of match : ', all_match.get_nb_match())
for mn in all_match.get_match_nodes():
aidge_core.remove_flatten(mn)
aidge_core.remove_flatten(model)
model.save("my_supported_LeNet")
@@ -73,4 +59,4 @@ for outNode in model.get_output_nodes():
#add PTQ part for testing
#created ordered graph, as in cpp and do
#quantizeNetwork(ordered_graph_view, 8, verbose);
\ No newline at end of file
aidge_quantization.quantizeNetwork(scheduler.get_static_scheduling(), 8, True)
Loading