Update custom rewrite example, which seems to have drifted a bit from the implementation.
authorStella Laurenzo <laurenzo@google.com>
Wed, 10 Apr 2019 23:53:03 +0000 (16:53 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Thu, 11 Apr 2019 17:53:01 +0000 (10:53 -0700)
PiperOrigin-RevId: 242968685

mlir/g3doc/QuickstartRewrites.md

index d6e9523..c0d6207 100644 (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>());
 }
 ```