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#
Recipie to remove a flatten operator.
- Parameters:
graph_view (
aidge_core.GraphView) – Graph view on which we want to apply the recipie
Fuse :cpp:function:
Aidge::BatchNormwith :cpp:function:Aidge::Convor :cpp:function:Aidge::FCNodes. 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#
Recipie to Fuse MatMul and Add operators into an
aidge_core.FCoperator.- Parameters:
graph_view (
aidge_core.GraphView) – Graph view on which we want to apply the recipie
Remove Dropout#
Remove Dropout operators.
Remove
DropoutNode.- Parameters:
graphView – Graph view to use graph matching on, in order to apply transfomrations.
Remove Flatten#
Remove Flatten operators.
- aidge_core.remove_flatten(graph_view: aidge_core.aidge_core.GraphView) None#
Recipie to remove a flatten operator.
- Parameters:
graph_view (
aidge_core.GraphView) – Graph view on which we want to apply the recipie
Remove
Flattenbefore :cpp:function:Aidge::FCNode.- 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 Convert 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.