Skip to content

Commit 8c0970d

Browse files
committed
rewrite test_silu.py
1 parent 7522589 commit 8c0970d

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

tests/Python/test_silu.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,17 @@ def foo(x):
3232
graph.lower_to_top_level_ir()
3333
print(graph._imported_module)
3434

35-
# CHECK: module {
35+
# CHECK: module {
3636
# CHECK-LABEL: func.func @forward
37-
# CHECK: %{{.*}} = tensor.empty() : tensor<4x4xf32>
38-
# CHECK: %[[RES:.*]] = linalg.generic {indexing_maps = [#map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0 : tensor<4x4xf32>) outs(%0 : tensor<4x4xf32>) {
39-
# CHECK: ^bb0(%in: f32, %out: f32):
40-
# CHECK: %{{.*}} = arith.negf %in : f32
41-
# CHECK: %{{.*}} = math.exp %{{.*}} : f32
42-
# CHECK: %{{.*}} = arith.constant 1.000000e+00 : f32
43-
# CHECK: %{{.*}} = arith.addf %{{.*}}, %{{.*}} : f32
44-
# CHECK: %{{.*}} = arith.divf %in, %{{.*}} : f32
45-
# CHECK: linalg.yield %{{.*}} : f32
46-
# CHECK: } -> tensor<4x4xf32>
47-
# CHECK: return %[[RES]] : tensor<4x4xf32>
48-
# CHECK: }
49-
# CHECK: }
37+
# CHECK: %[[EMPTY:.*]] = tensor.empty() : tensor<4x4xf32>
38+
# CHECK: %[[RES:.*]] = linalg.generic {.*} ins(%arg0 : tensor<4x4xf32>) outs(%[[EMPTY]] : tensor<4x4xf32>) {
39+
# CHECK: ^bb0(%in: f32, %out: f32):
40+
# CHECK: %[[NEG:.*]] = arith.negf %in : f32
41+
# CHECK: %[[EXP:.*]] = math.exp %[[NEG]] : f32
42+
# CHECK: %[[ONE:.*]] = arith.constant 1.000000e+00 : f32
43+
# CHECK: %[[ADD:.*]] = arith.addf %[[EXP]], %[[ONE]] : f32
44+
# CHECK: %[[DIV:.*]] = arith.divf %in, %[[ADD]] : f32
45+
# CHECK: linalg.yield %[[DIV]] : f32
46+
# CHECK: } -> tensor<4x4xf32>
47+
# CHECK: return %[[RES]] : tensor<4x4xf32>
5048

0 commit comments

Comments
 (0)