|
29 | 29 | import numpy as np |
30 | 30 | import qonnx.core.data_layout as DataLayout |
31 | 31 | import warnings |
32 | | - |
33 | | -# Protobuf onnx graph node type |
34 | | -from onnx import NodeProto # noqa |
35 | 32 | from onnx import helper as oh |
36 | | -# Protobuf onnx graph node type |
37 | | -from onnx import NodeProto # noqa |
38 | | -# QONNX wrapper of ONNX model graphs |
39 | | -from qonnx.core.modelwrapper import ModelWrapper |
40 | 33 | from qonnx.core.datatype import DataType |
| 34 | + |
| 35 | +# QONNX wrapper of ONNX model graphs |
41 | 36 | from qonnx.core.modelwrapper import ModelWrapper |
42 | 37 | from qonnx.custom_op.registry import getCustomOp |
43 | 38 | from qonnx.transformation.base import Transformation |
|
47 | 42 |
|
48 | 43 | from finn.transformation.util import group_inputs_by_category |
49 | 44 |
|
| 45 | +# Protobuf onnx graph node type |
| 46 | +from onnx import NodeProto # noqa |
| 47 | + |
50 | 48 |
|
51 | 49 | # Note: Old name kept for compatibility reasons but actually allows to absorb |
52 | 50 | # any bias irrespective of signedness which might result in changed signedness |
@@ -186,19 +184,6 @@ def apply(self, model: ModelWrapper): |
186 | 184 | return model, graph_modified |
187 | 185 |
|
188 | 186 |
|
189 | | -# Groups inputs by categories, i.e., groups dynamic inputs first, followed by |
190 | | -# initializers. Keeps order of inputs in each category. |
191 | | -def group_inputs_by_category(node: NodeProto, model: ModelWrapper): # noqa |
192 | | - # First select all dynamic inputs, which are those without initializer |
193 | | - # tensor |
194 | | - dynamics = [i for i in node.input if model.get_initializer(i) is None] |
195 | | - # Select all input which are initializers, which, by exclusion, are all |
196 | | - # those not among the dynamic inputs |
197 | | - initializers = [i for i in node.input if i not in dynamics] |
198 | | - # Return lists of dynamic anc initializer inputs |
199 | | - return dynamics, initializers |
200 | | - |
201 | | - |
202 | 187 | class AbsorbAddIntoMultiThreshold(Transformation): |
203 | 188 | """Absorb preceding Add ops into MultiThreshold by updating the threshold |
204 | 189 | values. Only scalar/1D add vectors can be absorbed.""" |
|
0 commit comments