Today I found a bug in the BiasAddSimplifier pass. This pass replaces bias_add to expanding bias and add operation. However, after it modifies the bias_add expr, the subsequent exprs that rely on this expr will lose its type information. Therefore, when there’re more than one bias_add exprs, the second one will fail because it requires type information to expand the bias.
We can certainly fix this bug by some ad hoc solution. But I wonder if we should infer the type by default in Relay’s ExprMutator visitor whenever possible. I believe this can prevent many mistakes when people add new passes to Relay.
I’d like to hear thoughts from the community.