Recipes#
Recipes are relatively generic, built-in functionnalities for manipulating a compute graph in Aidge. Some are built with Aidge’s graph matching engine, do not hesitate to have a look at their source code to understand how they work and build similar functionnalities!
🚧 The list of recipes is still growing!
Fuse BatchNorm#
Fuse batch normalization with the preceding Conv or FC operator, if possible.
- aidge_core.fuse_batchnorm(graph_view: aidge_core.aidge_core.GraphView) None #
Recipe to remove a flatten operator.
- Parameters:
graph_view (
aidge_core.GraphView
) – Graph view on which we want to apply the recipe
Fuse :cpp:function:
Aidge::BatchNorm
with :cpp:function:Aidge::Conv
or :cpp:function:Aidge::FC
Nodes. Ref: https://nenadmarkus.com/p/fusing-batchnorm-and-conv/.- Parameters:
graphView – Graph view to use graph matching on, in order to apply transformations.
Constant folding#
Fold constant operators (like ONNX Simplifier).
Fuse Mul Add#
Fuse Mul followed by Add operators into a FC operator.
- aidge_core.fuse_mul_add(graph_view: aidge_core.aidge_core.GraphView) None #
Recipe to Fuse MatMul and Add operators into an
aidge_core.FC
operator.- Parameters:
graph_view (
aidge_core.GraphView
) – Graph view on which we want to apply the recipe
Remove Dropout#
Remove Dropout operators.
Remove
Dropout
Node.- Parameters:
graphView – Graph view to use graph matching on, in order to apply transfomrations.
- Returns:
size_t Number of identity nodes removed
Remove Flatten#
Remove Flatten operators.
- aidge_core.remove_flatten(graph_view: aidge_core.aidge_core.GraphView) None #
Recipe to remove a flatten operator.
- Parameters:
graph_view (
aidge_core.GraphView
) – Graph view on which we want to apply the recipe
Remove
Flatten
before :cpp:function:Aidge::FC
Node.- Parameters:
graphView – Graph view to use graph matching on, in order to apply transformations.
Explicit Cast Move#
Insert Cast and Move operators where needed (thus removing all implicit data type conversion and backend change data movement).
Add Cast and Move operators where needed to ensure no conversion needs to be done at the Operator level.
Expand meta operators#
Expand meta operators, replacing them with their inner graph (flatten the graph).
Flatten the graph by replacing the meta operators by their micro graph.
- Parameters:
recursive – If true, recursively replace meta operators until there is no more meta operator in the graph.