You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most graph transformations (here as well as in FINN) assume a particular order of node inputs, even if the operation is actually commutative, e.g. the add operation. There seems to be a clear distinction between "dynamic" (i.e., produced upstream) and initializer inputs. As far as I can tell, the assumption is always that dynamic inputs are listed first, followed by the initializers. Concretely, node.input[0] is used to refer to the (single) dynamic input to node. However, this does not always hold true and I have encountered multiple occasions where valid transformations did not apply or were applied incorrectly due to violations of this assumption: Xilinx/finn#878
New behavior
I propose to add a cleanup transformation to sort the node input list of such commutative operations to have the initializer inputs last. For all other types of transformations, input order already has special meaning and seems to be handled correctly.
Motivation
Ideally, transformations of commutative operations should not care for the input order. But as order is assumed in a lot of places right now, it seems to be easier to introduce a cleanup transformation to ensure the assumptions hold true.
Parts of QONNX being affected
A new cleanup transformation will be introduced and will be added to the default cleanup transformations of the ModelWrapper.
The text was updated successfully, but these errors were encountered:
Details
Most graph transformations (here as well as in FINN) assume a particular order of node inputs, even if the operation is actually commutative, e.g. the add operation. There seems to be a clear distinction between "dynamic" (i.e., produced upstream) and initializer inputs. As far as I can tell, the assumption is always that dynamic inputs are listed first, followed by the initializers. Concretely,
node.input[0]
is used to refer to the (single) dynamic input to node. However, this does not always hold true and I have encountered multiple occasions where valid transformations did not apply or were applied incorrectly due to violations of this assumption: Xilinx/finn#878New behavior
I propose to add a cleanup transformation to sort the node input list of such commutative operations to have the initializer inputs last. For all other types of transformations, input order already has special meaning and seems to be handled correctly.
Motivation
Ideally, transformations of commutative operations should not care for the input order. But as order is assumed in a lot of places right now, it seems to be easier to introduce a cleanup transformation to ensure the assumptions hold true.
Parts of QONNX being affected
A new cleanup transformation will be introduced and will be added to the default cleanup transformations of the
ModelWrapper
.The text was updated successfully, but these errors were encountered: