-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transformations should return whether a model was modified or not #6
Labels
enhancement
New feature or request
Comments
After having done some testing on how the current method of string comparison performs it seems like the actual performance impact is smaller than I had thought.
Since the comparison method via string serialization turns out to be cheap it might be interesting if we could introduce this as a comparison operator between |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Details
Currently a transformation on a model in looks like this:
The executed transformation, in this case
MoveChanLastUpstream
, may change the model, or it may not. In some cases it would be good to know if a transformation had any effect on the model. As example in the channelsLast transformation.Here I need to check if the transformation has converged to then stop iterating over the model. Currently this is solved, by converting the ONNX model to a sting at the beginning of the loop: https://github.com/fastmachinelearning/qonnx/blob/feature/qonnx_chan_last/src/qonnx/transformation/channelsLast.py#L46
And then checking at the end if anything changed: https://github.com/fastmachinelearning/qonnx/blob/feature/qonnx_chan_last/src/qonnx/transformation/channelsLast.py#L69
And while this works fine it might incur large compute and memory penalties for larger models.
New behavior
When the ModelWrapper class is ported over to QONNX it would be nice if the behavior of the
transform
member function could change.In particular it would be nice if the function could optionally return whether a model was modified. As example like this:
With the default set as
return_was_modified=False
, this would keep the interface stable.Motivation
This change would simplify development and make parts of QONNX faster. In particular the channelsLast transformation could benefit form this change: https://github.com/fastmachinelearning/qonnx/blob/feature/qonnx_chan_last/src/qonnx/transformation/channelsLast.py#L34
Parts of QONNX being affected
This change would affect all transformations. In particular all transformations would then be required to return a boolean flag to indicate whether they modified the model or not.
The text was updated successfully, but these errors were encountered: