Skip to content
Snippets Groups Projects
Commit 37544a8b authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[Transform] update transformation writing instructions

parent afcb95e9
No related branches found
No related tags found
No related merge requests found
......@@ -2,10 +2,11 @@
Guide to writing FINN transformations
-------------------------------------
* Your transformation should take in an ONNX model, and return a tuple with
(transformed_model: ModelProto, model_was_changed: Bool)
* The original model should not be modified, use e.g. copy.deepcopy() if you
want to work on a copy of the graph for modifications.
* Your transformation should take in a ModelWrapper, and return a tuple with
(transformed_model: ModelWrapper, model_was_changed: Bool)
* The transformations are meant to be applied using the .transform functions
in ModelWrapper. This makes a deep copy of the input model by default, so
you don't have to.
* model_was_changed indicates whether your transformation made any changes to
the model. If you know your transformation needs to be called only once and
repeated calls have no further effect, you can return False even if the model
......@@ -13,5 +14,6 @@ Guide to writing FINN transformations
* You MUST return model_was_changed=False at some point when your transformation
is called multiple times, otherwise apply_repeated() will loop infinitely.
* If you cannot guarantee that the transformation will reach a fixed point,
you must declare this and return only the transformed model instead of a tuple.
you must declare this and notify the user to use .transform_single() instead
of .transform_repeated()
"""
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment