Optimize graph#
Change topology (model isomorphism)#
These optimizations update the topology of the computation graph however they do not change its mathematical properties (i.e. for the same output the model before and after optimization will provide the same result), that is what we call model isomorphism.
Fuse MatMul & added#
ONNX graph can export Dense
/ FC
operator as two operator, MatMul
and Add
. This recipie replace these two operator and create a FC
operator, reusing the Producers attached to the MatMul
and Add
operator.
Tiling#
Proposed implementation#
Graph transformation:
Scheduling:
Multi-layer spatial tiling#
Goal: tile spatially multiple layers.
Proposed method:
Specify the required tile’s position and size at some place in the block;
Propagate backward the required spatial tile’s position and size (with a mechanism similar to receptive field in N2D2);
Create the tiling operators and duplicate the subgraph.
When computing tile sizes, Pad
operators must be handled specifically. Only edge tiles should keep the padding corresponding to the position of the tile on edge.
An offset may be required on the final relative tile’s position and size to take into account dimensions reduction due to the convolution.