[Mlir-commits] [mlir] 96698df - mlir/tosa: supply better documentation for tosa.pad

Ramkumar Ramachandra llvmlistbot at llvm.org
Wed May 24 13:26:14 PDT 2023


Author: Ramkumar Ramachandra
Date: 2023-05-24T21:25:44+01:00
New Revision: 96698df3d3553d70480adf0eb0d9cf104d7a55c9

URL: https://github.com/llvm/llvm-project/commit/96698df3d3553d70480adf0eb0d9cf104d7a55c9
DIFF: https://github.com/llvm/llvm-project/commit/96698df3d3553d70480adf0eb0d9cf104d7a55c9.diff

LOG: mlir/tosa: supply better documentation for tosa.pad

This patch modifies the description in TosaOps.td, taking into account
all the arguments, and supplying examples.

Signed-off-by: Ramkumar Ramachandra <r at artagnon.com>

Differential Revision: https://reviews.llvm.org/D139089

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
index 359690db1eb7b..1f60353d0a3b7 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
@@ -1519,7 +1519,23 @@ def Tosa_PadOp : Tosa_Op<"pad", [
   let summary = "Pads a tensor with value specified.";
 
   let description = [{
-    Pads a tensor along borders of each dimension with pad_value.
+    The `tosa.pad` operation pads a tensor along borders of each dimension with
+    `pad_const` (defaults to zero), given a padding configuration `padding`
+    specifying low and high values along the dimensions.
+
+    Example:
+
+    ```mlir
+    %0 = arith.constant dense<[[1, 2], [3, 4]]> : tensor<2x2xi32>
+    "tosa.pad"(%arg0, %0)  : (tensor<1x2xf32>, tensor<2x2xi32>)  -> (tensor<4x9xf32>)
+    ```
+
+    Example 2:
+
+    ```mlir
+    %0 = arith.constant dense<[[-1, 2], [3, 4]]> : tensor<2x2xi32>
+    "tosa.pad"(%arg0, %0)  : (tensor<1x2xf32>, tensor<2x2xi32>)  -> (tensor<?x9xf32>)
+    ```
   }];
 
   let arguments = (ins


        


More information about the Mlir-commits mailing list