xqdan opened a new pull request #7789: URL: https://github.com/apache/tvm/pull/7789
Thanks for contributing to TVM! Please refer to guideline https://tvm.apache.org/docs/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @ them in the pull request thread. @lixiaoquan @zhiics @srkreddy1238 This bug will lead redundent operations in graph ir when parsering bert: ``` %4 = add(%0, %3) /* bert/embeddings/add */; %5 = strided_slice(meta[relay.Constant][1], begin=[0, 0], end=[128, -1], strides=[1, 1], slice_mode="size") /* bert/embeddings/Slice */; %6 = reshape(%5, newshape=[1, 128, 768]) /* bert/embeddings/Reshape_4 */; %7 = add(%4, %6) /* bert/embeddings/add_1 */; %8 = mean(%7, axis=[2], keepdims=True) /* bert/embeddings/LayerNorm/moments/StopGradient */; %9 = subtract(%7, %8); %10 = multiply(%9, %9) /* bert/embeddings/LayerNorm/moments/SquaredDifference */; %11 = mean(%10, axis=[2], keepdims=True) /* bert/embeddings/LayerNorm/moments/variance */; %12 = add(%11, 1e-12f) /* bert/embeddings/LayerNorm/batchnorm/add */; %13 = power(%12, -0.5f) /* bert/embeddings/LayerNorm/batchnorm/Rsqrt */; %14 = multiply(%13, meta[relay.Constant][2]) /* bert/embeddings/LayerNorm/batchnorm/mul */; %15 = multiply(%7, %14) /* bert/embeddings/LayerNorm/batchnorm/mul_1 */; %16 = **mean**(%7, axis=[2], keepdims=True) /* bert/embeddings/LayerNorm/moments/mean */; %17 = multiply(%16, %14) /* bert/embeddings/LayerNorm/batchnorm/mul_2 */; %18 = subtract(meta[relay.Constant][3], %17) /* bert/embeddings/LayerNorm/batchnorm/sub */; ``` The last mean is redundent op created by _set_span. Since this is pb parsering flow, does anyone know how to make a unitest? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
