Skip to content

Commit 4f180d3

Browse files
authored
Fix formatting on spec examples (#2117)
As pointed out in #2097 (comment), MLIR doesn't insert spaces between the brackets and the content. I've also made minor formatting improvements.
1 parent b27ef13 commit 4f180d3

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

docs/spec.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func.func @main(
3939
%0 = "stablehlo.reshape"(%image) : (tensor<28x28xf32>) -> tensor<1x784xf32>
4040
%1 = "stablehlo.dot"(%0, %weights) : (tensor<1x784xf32>, tensor<784x10xf32>) -> tensor<1x10xf32>
4141
%2 = "stablehlo.add"(%1, %bias) : (tensor<1x10xf32>, tensor<1x10xf32>) -> tensor<1x10xf32>
42-
%3 = "stablehlo.constant"() { value = dense<0.0> : tensor<1x10xf32> } : () -> tensor<1x10xf32>
42+
%3 = "stablehlo.constant"() {value = dense<0.0> : tensor<1x10xf32>} : () -> tensor<1x10xf32>
4343
%4 = "stablehlo.maximum"(%2, %3) : (tensor<1x10xf32>, tensor<1x10xf32>) -> tensor<1x10xf32>
4444
"func.return"(%4): (tensor<1x10xf32>) -> ()
4545
}
@@ -1965,8 +1965,10 @@ semantics change.
19651965
```mlir
19661966
%results = "stablehlo.composite"(%input0, %input1) {
19671967
name = "my_namespace.my_op",
1968+
composite_attributes = {
1969+
my_attribute = "my_value"
1970+
},
19681971
decomposition = @my_op,
1969-
composite_attributes = { my_attribute = "my_value" },
19701972
version = 1 : i32
19711973
} : (tensor<f32>, tensor<f32>) -> tensor<f32>
19721974
```
@@ -3871,7 +3873,7 @@ Semantics of `outfeed_config` is implementation-defined.
38713873
#### Examples
38723874

38733875
```mlir
3874-
%result = "stablehlo.outfeed"(%inputs0, %token) {
3876+
%result = "stablehlo.outfeed"(%input0, %token) {
38753877
outfeed_config = ""
38763878
} : (tensor<2x2x2xi64>, !stablehlo.token) -> !stablehlo.token
38773879
```

stablehlo/dialect/StablehloOps.td

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ def StableHLO_OutfeedOp : StableHLO_Op<"outfeed",
10201020

10211021
Example:
10221022
```mlir
1023-
%result = "stablehlo.outfeed"(%inputs0, %token) :
1023+
%result = "stablehlo.outfeed"(%input0, %token) :
10241024
(tensor<2x2x2xi64>, !stablehlo.token) -> !stablehlo.token
10251025
```
10261026
}];
@@ -2100,9 +2100,11 @@ def StableHLO_CompositeOp : StableHLO_Op<"composite", [DeclareOpInterfaceMethods
21002100

21012101
Example:
21022102
```mlir
2103-
%results = stablehlo.composite "my.op" %arg0, %arg1 {
2103+
%results = stablehlo.composite "my.op" %input0, %input1 {
2104+
composite_attributes = {
2105+
my_attribute = "my_value"
2106+
},
21042107
decomposition = @my_op,
2105-
composite_attributes = { my_attribute = "my_value" },
21062108
version = 1 : i32
21072109
} : (tensor<f32>, tensor<f32>) -> tensor<f32>
21082110
```

0 commit comments

Comments
 (0)