Skip to content

Commit

Permalink
Add explicit check that scatter body is supported
Browse files Browse the repository at this point in the history
  • Loading branch information
pengmai committed Sep 18, 2024
1 parent 47bf823 commit a1cc40d
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,12 @@ class AutoDiffScatterRev
return op.emitError() << "Expected exactly 1 update operand";
}

Operation &innerOp = op.getUpdateComputation().front().front();
if (!isa<AddOp, ReturnOp>(innerOp)) {
return op.emitError()
<< "Unsupported operation in scatter rev autodiff: " << *orig;
}

Value updates = op.getUpdates().front();
ScatterDimensionNumbersAttr scatterDims = op.getScatterDimensionNumbers();
ArrayRef<int64_t> updateWindowDims = scatterDims.getUpdateWindowDims();
Expand Down

0 comments on commit a1cc40d

Please sign in to comment.