We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8139ea5 commit aaf7f92Copy full SHA for aaf7f92
src/Dialect/ONNX/Transforms/DQBinaryQOpt.cpp
@@ -538,7 +538,10 @@ struct FoldBinaryThroughQDQ : public OpRewritePattern<BinOp> {
538
rewriter.replaceOp(op, dqAct.getResult());
539
540
// STEP 7: Remove Q->DQ chain
541
- for (Operation *user : quantOutputOp.getY().getUsers()) {
+
542
+ // prevent iterating and removing elements
543
+ auto users = llvm::make_early_inc_range(quantOutputOp.getY().getUsers());
544
+ for (Operation *user : users) {
545
if (auto tailDQ = llvm::dyn_cast<ONNXDequantizeLinearOp>(user)) {
546
(void)tryRemoveQThenDQChain(rewriter, tailDQ);
547
}
0 commit comments