Skip to content

Replace for forked graph

Required prerequisites

I am currently working on aidge_onnx#78 (closed)

Where I want to transform this graph:

flowchart TD
	Identity --> Div --> Erf --> Add --> Mul0 --> Mul1;
	Identity --> Mul0

Into this graph:

flowchart TD
	Identity;
	subgraph GeLU
	Identity0 --> Div --> Erf --> Add --> Mul0 --> Mul1;
	Identity0 --> Mul0;
	end
	Identity --> Identity0;

The transformation consist in matching the pattern, adding an IdentityNode, creating a GeLU that old the graph + the new identity and then replacing the MetaOperator.

However this is not a case handled by replace. I think for now I will do the graph modification "by hand". But I want to raise the discussion if it is relevant to consider this case for replace?