@@ -589,12 +589,14 @@ func.func @test_tanh(%arg0 : tensor<10x10xf32>) -> tensor<10x10xf32> {
589
589
func.func @test_clip (%arg0: tensor <3 xi32 >, %arg1: tensor <i32 >, %arg2: tensor <i32 >) -> tensor <3 xi32 > {
590
590
%0 = " onnx.Clip" (%arg0 , %arg1 , %arg2 ) : (tensor <3 xi32 >, tensor <i32 >, tensor <i32 >) -> tensor <3 xi32 >
591
591
return %0 : tensor <3 xi32 >
592
- // CHECK-LABEL: func @test_clip
593
- // CHECK-SAME: ([[PARAM_0_:%.+]]: tensor<3xi32>, [[PARAM_1_:%.+]]: tensor<i32>, [[PARAM_2_:%.+]]: tensor<i32>) -> tensor<3xi32>
594
- // CHECK-NEXT: [[VAR_0_:%.+]] = tosa.maximum [[PARAM_0_]], [[PARAM_1_]] : (tensor<3xi32>, tensor<i32>) -> tensor<3xi32>
595
- // CHECK-NEXT: [[VAR_1_:%.+]] = tosa.minimum [[VAR_0_]], [[PARAM_2_]] : (tensor<3xi32>, tensor<i32>) -> tensor<3xi32>
596
- // CHECK-NEXT: return [[VAR_1_]] : tensor<3xi32>
597
- // CHECK-NEXT: }
592
+ // CHECK-LABEL: func.func @test_clip
593
+ // CHECK-SAME: ([[PARAM_0_:%.+]]: tensor<3xi32>, [[PARAM_1_:%.+]]: tensor<i32>, [[PARAM_2_:%.+]]: tensor<i32>) -> tensor<3xi32> {
594
+ // CHECK: [[VAR_0_:%.+]] = tosa.reshape [[PARAM_1_]] {new_shape = array<i64: 1>} : (tensor<i32>) -> tensor<1xi32>
595
+ // CHECK-DAG: [[VAR_1_:%.+]] = tosa.maximum [[PARAM_0_]], [[VAR_0_]] : (tensor<3xi32>, tensor<1xi32>) -> tensor<3xi32>
596
+ // CHECK-DAG: [[VAR_2_:%.+]] = tosa.reshape [[PARAM_2_]] {new_shape = array<i64: 1>} : (tensor<i32>) -> tensor<1xi32>
597
+ // CHECK: [[VAR_3_:%.+]] = tosa.minimum [[VAR_1_]], [[VAR_2_]] : (tensor<3xi32>, tensor<1xi32>) -> tensor<3xi32>
598
+ // CHECK: return [[VAR_3_]] : tensor<3xi32>
599
+ // CHECK: }
598
600
}
599
601
600
602
// -----
@@ -604,11 +606,12 @@ func.func @test_clip_default_min_f32(%arg0: tensor<3xf32>, %arg1: tensor<f32>) -
604
606
%cst = " onnx.NoValue" () {value } : () -> none
605
607
%0 = " onnx.Clip" (%arg0 , %cst , %arg1 ) : (tensor <3 xf32 >, none , tensor <f32 >) -> tensor <3 xf32 >
606
608
return %0 : tensor <3 xf32 >
607
- // CHECK-LABEL: func @test_clip_default_min_f32
608
- // CHECK-SAME: ([[PARAM_0_:%.+]]: tensor<3xf32>, [[PARAM_1_:%.+]]: tensor<f32>) -> tensor<3xf32>
609
- // CHECK-NEXT: [[VAR_0_:%.+]] = tosa.minimum [[PARAM_0_]], [[PARAM_1_]] : (tensor<3xf32>, tensor<f32>) -> tensor<3xf32>
610
- // CHECK-NEXT: return [[VAR_0_]] : tensor<3xf32>
611
- // CHECK-NEXT: }
609
+ // CHECK-LABEL: func.func @test_clip_default_min_f32
610
+ // CHECK-SAME: ([[PARAM_0_:%.+]]: tensor<3xf32>, [[PARAM_1_:%.+]]: tensor<f32>) -> tensor<3xf32> {
611
+ // CHECK: [[VAR_0_:%.+]] = tosa.reshape [[PARAM_1_]] {new_shape = array<i64: 1>} : (tensor<f32>) -> tensor<1xf32>
612
+ // CHECK: [[VAR_1_:%.+]] = tosa.minimum [[PARAM_0_]], [[VAR_0_]] : (tensor<3xf32>, tensor<1xf32>) -> tensor<3xf32>
613
+ // CHECK: return [[VAR_1_]] : tensor<3xf32>
614
+ // CHECK: }
612
615
}
613
616
614
617
// -----
@@ -618,11 +621,12 @@ func.func @test_clip_default_max_bf16(%arg0: tensor<3xbf16>, %arg1: tensor<bf16>
618
621
%cst = " onnx.NoValue" () {value } : () -> none
619
622
%0 = " onnx.Clip" (%arg0 , %arg1 , %cst ) : (tensor <3 xbf16 >, tensor <bf16 >, none ) -> tensor <3 xbf16 >
620
623
return %0 : tensor <3 xbf16 >
621
- // CHECK-LABEL: func @test_clip_default_max_bf16
622
- // CHECK-SAME: ([[PARAM_0_:%.+]]: tensor<3xbf16>, [[PARAM_1_:%.+]]: tensor<bf16>) -> tensor<3xbf16>
623
- // CHECK-NEXT: [[VAR_0_:%.+]] = tosa.maximum [[PARAM_0_]], [[PARAM_1_]] : (tensor<3xbf16>, tensor<bf16>) -> tensor<3xbf16>
624
- // CHECK-NEXT: return [[VAR_0_]] : tensor<3xbf16>
625
- // CHECK-NEXT: }
624
+ // CHECK-LABEL: func.func @test_clip_default_max_bf16
625
+ // CHECK-SAME: ([[PARAM_0_:%.+]]: tensor<3xbf16>, [[PARAM_1_:%.+]]: tensor<bf16>) -> tensor<3xbf16> {
626
+ // CHECK: [[VAR_0_:%.+]] = tosa.reshape [[PARAM_1_]] {new_shape = array<i64: 1>} : (tensor<bf16>) -> tensor<1xbf16>
627
+ // CHECK: [[VAR_1_:%.+]] = tosa.maximum [[PARAM_0_]], [[VAR_0_]] : (tensor<3xbf16>, tensor<1xbf16>) -> tensor<3xbf16>
628
+ // CHECK: return [[VAR_1_]] : tensor<3xbf16>
629
+ // CHECK: }
626
630
}
627
631
628
632
// -----
@@ -648,14 +652,14 @@ func.func @test_clip_constant_minimum_maximum_non_splat(%arg0: tensor<3xi32>) ->
648
652
%cst2 = " onnx.Constant" () {value = dense <[2 ]> : tensor <1 xi32 >} : () -> tensor <1 xi32 >
649
653
%0 = " onnx.Clip" (%arg0 , %cst1 , %cst2 ) : (tensor <3 xi32 >, tensor <3 xi32 >, tensor <1 xi32 >) -> tensor <3 xi32 >
650
654
return %0 : tensor <3 xi32 >
651
- // CHECK-LABEL: func @test_clip_constant_minimum_maximum_non_splat
652
- // CHECK-SAME: ([[PARAM_0_:%.+]]: tensor<3xi32>) -> tensor<3xi32>
653
- // CHECK-NEXT: [[VAR_0_:%.+]] = "tosa.const"() <{value = dense<[-1, 0, 1]> : tensor<3xi32>}> : () -> tensor<3xi32>
654
- // CHECK-NEXT: [[VAR_1_:%.+]] = "tosa.const"() <{value = dense<2> : tensor<1xi32>}> : () -> tensor<1xi32>
655
- // CHECK-NEXT: [[VAR_2_:%.+]] = tosa.maximum [[PARAM_0_]], [[VAR_0_]] : (tensor<3xi32>, tensor<3xi32>) -> tensor<3xi32>
656
- // CHECK-NEXT: [[VAR_3_:%.+]] = tosa.minimum [[VAR_2_]], [[VAR_1_]] : (tensor<3xi32>, tensor<1xi32>) -> tensor<3xi32>
657
- // CHECK-NEXT: return [[VAR_3_]] : tensor<3xi32>
658
- // CHECK-NEXT: }
655
+ // CHECK-LABEL: func.func @test_clip_constant_minimum_maximum_non_splat
656
+ // CHECK-SAME: ([[PARAM_0_:%.+]]: tensor<3xi32>) -> tensor<3xi32> {
657
+ // CHECK-DAG: [[VAR_0_:%.+]] = "tosa.const"() <{value = dense<[-1, 0, 1]> : tensor<3xi32>}> : () -> tensor<3xi32>
658
+ // CHECK-DAG: [[VAR_1_:%.+]] = "tosa.const"() <{value = dense<2> : tensor<1xi32>}> : () -> tensor<1xi32>
659
+ // CHECK: [[VAR_2_:%.+]] = tosa.maximum [[PARAM_0_]], [[VAR_0_]] : (tensor<3xi32>, tensor<3xi32>) -> tensor<3xi32>
660
+ // CHECK: [[VAR_3_:%.+]] = tosa.minimum [[VAR_2_]], [[VAR_1_]] : (tensor<3xi32>, tensor<1xi32>) -> tensor<3xi32>
661
+ // CHECK: return [[VAR_3_]] : tensor<3xi32>
662
+ // CHECK: }
659
663
}
660
664
661
665
func.func @test_div_decomposed_broadcast (%arg0: tensor <13 x21 x1 xf32 >, %arg1: tensor <1 xf32 >) -> tensor <13 x21 x1 xf32 > {
0 commit comments