@@ -180,32 +180,30 @@ def adjust_graph(self, model, input_positions, node_in_focus, quantized_nodes, n
180
180
return model
181
181
182
182
183
- class IntroduceQuantnode (Transformation ):
184
- """This transformation can be used to introduce a Quant node for a specific type of node in the graph.
185
- Users would be able to specify the location of the quant node by providing the input and output indexs
186
- as the parameters.
183
+ class QuantizeGraph (Transformation ):
184
+ """This transformation can be used to introduce a Quant node for particular nodes in the graph,
185
+ determined based on either op_type or node name.
186
+ For the particular nodes identified, users can specify the location of the Quant nodes by providing
187
+ the input and output indices where Quant nodes are to be inserted.
188
+ Assumes the input model is cleaned-up with all intermediate shapes specified and nodes given
189
+ unique names already.
187
190
188
- 1) Expectations:
189
- a) Onnx model in the modelwraper format.
190
- b) Model must be cleaned using cleanup_model qonnx.util.cleanup.cleanup_model()
191
- c) Batchsize to be set.
191
+ 2) Steps to transform are
192
+ Step1: Finding the input for the quant node.
193
+ Step2: Finding the consumer of the quant node output.
194
+ Step3: Finding the shape for the output tensor of quant node.
195
+ Note: The output tensor of the quant node must have the same shape as the
196
+ consumer of the input to the quant node.
192
197
193
- 2) Steps to transform are
194
- Step1: Finding the input for the quant node.
195
- Step2: Finding the consumer of the quant node output.
196
- Step3: Finding the shape for the output tensor of quant node.
197
- Note: The output tensor of the quant node must have the same shape as the
198
- consumer of the input to the quant node.
198
+ 3) Introduction to quantnodes will be done with precedence to "Name" in comparison to "op_type".
199
199
200
- 3) Introduction to quantnodes will be done with precedence to "Name" in comparison to "op_type".
200
+ 4) Assert:
201
+ a) The input is a dictionary representing the node names as keys and a list of quant positions
202
+ as values.
203
+ b) The input dictionary must have atleast one mac node (Conv, gemm, matmul) for the transformation.
201
204
202
- 4) Assert:
203
- a) The input is a dictionary representing the node names as keys and a list of quant positions
204
- as values.
205
- b) The input dictionary must have atleast one mac node (Conv, gemm, matmul) for the transformation.
206
-
207
- 5) Return:
208
- Returns a cleaned version of the model.
205
+ 5) Return:
206
+ Returns a cleaned version of the model.
209
207
210
208
"""
211
209
0 commit comments