Open
Description
I have a ONNX model graph: multi-input -> concat -> transpose, for a better performance for some target device, we need to swap transpose and concat, now the new graph will be multi x (input-> transpose) -> concat (the axis will change), so I wrote a code based on onnxscript.rewriter.pattern
def pattern(op, shape, *seq):
x = op.Concat(*seq, axis=1)
x = op.Transpose(x, perm=[0,1,3,2])
return op.Reshape(x, shape)
def rewrite(op, shape, *seq: Sequence[ValuePattern]):
print(seq)
x = op.Concat(seq, axis=3)
return op.Transpose(x, perm=[0,3,1,2])
but seq will be considered as one input while converted to _pattern_ir._target_pattern
the number of inputs will be dynamic, it seemed to be the RewriteRule
class not support the feature now.
BRs, Joan.