I am using tensorflow
Graph Transform Tool to quantize the graph using
input_names = ["prefix/input"]
output_names = ["final_result"]
transforms1 = ["strip_unused_nodes","fold_constants(ignore_errors=true)", "fold_batch_norms", "fold_old_batch_norms","quantize_weights" ]
transformed_graph_def = TransformGraph(graph.as_graph_def(), input_names,output_names, transforms1)
I use the option quantize_weights
to quantize the weights in graph, I know that certain nodes can remain unquantized by changing threshold minimum_size
in quantize_weights
, so leaving some nodes unquantized is certainly possible.
I want to quantize the weights of all nodes except a particular node with the name K or a set of nodes that have a name in K(set). How can this be achieved?
EDIT: the previous answer refered to Tensorflow Lite code. I updated it to refer to Tensorflow.
Looking at the implementation of Tensorflow's quantize_weights, these are the instances where weights don't get quantized:
minimum_size
)If you are able to modify nodes in the graph so that they are excluded by one of the above rules, then quantize, then revert the nodes to the pre-quantized state, you might be able to do this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With