Update custom rewrite example, which seems to have drifted a bit from the implementation.

PiperOrigin-RevId: 242968685
This commit is contained in:
Stella Laurenzo 2019-04-10 16:53:03 -07:00 committed by Mehdi Amini
parent b0055ab5c3
commit d468eaccfc
1 changed files with 5 additions and 4 deletions

View File

@ -131,10 +131,11 @@ def : Pat<(TF_LeakyReluOp $arg, F32Attr:$a),
```
```c++
void createTFLLeakyRelu(Operation *op, ArrayRef<Value *> operands,
ArrayRef<Attribute> attrs, PatternRewriter &rewriter) {
rewriter.replaceOpWithNewOp<mlir::TFL::LeakyReluOp>(
op, operands[0]->getType(), /*arg=*/operands[0],
static Value *createTFLLeakyRelu(Operation *op, ArrayRef<Value *> operands,
ArrayRef<Attribute> attrs,
PatternRewriter &rewriter) {
return rewriter.create<mlir::TFL::LeakyReluOp>(
op->getLoc(), operands[0]->getType(), /*arg=*/operands[0],
/*alpha=*/attrs[0].cast<FloatAttr>());
}
```