Where does the layout transform of each op happen during alter_op_layout pass?

I see. That’s one important info I didn’t catch before. Thank you for letting me know!

But now I’m still not sure when the 4D to 5D/6D conversion of tensors happen, as well as all expand_dims and layout_transform. Does it happen somewhere before the alter_op_layout pass?