@@ -2084,3 +2084,39 @@ func.func @test_mul_out_i16(%arg0: tensor<13x21x3xi8>, %arg1: tensor<13x1x3xi8>,
2084
2084
%0 = tosa.mul %arg0 , %arg1 , %shift : (tensor <13 x21 x3 xi8 >, tensor <13 x1 x3 xi8 >, tensor <1 xi8 >) -> tensor <13 x21 x3 xi16 >
2085
2085
return %0 : tensor <13 x21 x3 xi16 >
2086
2086
}
2087
+
2088
+ // -----
2089
+
2090
+ // CHECK-LABEL: test_clamp_nan_min_val
2091
+ func.func @test_clamp_nan_min_val (%arg0: tensor <13 x21 x3 xf32 >) -> tensor <13 x21 x3 xf32 > {
2092
+ // expected-error@+1 {{'tosa.clamp' op min/max attributes should not be 'NaN', got min_val=0xFFFFFFFF : f32, max_val=1.000000e+00 : f32}}
2093
+ %0 = tosa.clamp %arg0 {min_val = 0xFFFFFFFF : f32 , max_val = 1.0 : f32 } : (tensor <13 x21 x3 xf32 >) -> tensor <13 x21 x3 xf32 >
2094
+ return %0 : tensor <13 x21 x3 xf32 >
2095
+ }
2096
+
2097
+ // -----
2098
+
2099
+ // CHECK-LABEL: test_clamp_nan_max_val
2100
+ func.func @test_clamp_nan_max_val (%arg0: tensor <13 x21 x3 xf32 >) -> tensor <13 x21 x3 xf32 > {
2101
+ // expected-error@+1 {{'tosa.clamp' op min/max attributes should not be 'NaN', got min_val=2.300000e+00 : f32, max_val=0x7FFFFFFF : f32}}
2102
+ %0 = tosa.clamp %arg0 {min_val = 2.3 : f32 , max_val = 0x7FFFFFFF : f32 } : (tensor <13 x21 x3 xf32 >) -> tensor <13 x21 x3 xf32 >
2103
+ return %0 : tensor <13 x21 x3 xf32 >
2104
+ }
2105
+
2106
+ // -----
2107
+
2108
+ // CHECK-LABEL: test_clamp_min_larger_than_max_int8
2109
+ func.func @test_clamp_min_larger_than_max_int8 (%arg0: tensor <13 x21 x3 xi8 >) -> tensor <13 x21 x3 xi8 > {
2110
+ // expected-error@+1 {{'tosa.clamp' op expected min_val <= max_val, got min_val=127 : i8, max_val=-128 : i8}}
2111
+ %0 = tosa.clamp %arg0 {min_val = 127 : i8 , max_val = -128 : i8 } : (tensor <13 x21 x3 xi8 >) -> tensor <13 x21 x3 xi8 >
2112
+ return %0 : tensor <13 x21 x3 xi8 >
2113
+ }
2114
+
2115
+ // -----
2116
+
2117
+ // CHECK-LABEL: test_clamp_min_larger_than_max_fp32
2118
+ func.func @test_clamp_min_larger_than_max_fp32 (%arg0: tensor <13 x21 x3 xf32 >) -> tensor <13 x21 x3 xf32 > {
2119
+ // expected-error@+1 {{'tosa.clamp' op expected min_val <= max_val, got min_val=2.000000e+00 : f32, max_val=-1.100000e+00 : f32}}
2120
+ %0 = tosa.clamp %arg0 {min_val = 2.0 : f32 , max_val = -1.1 : f32 } : (tensor <13 x21 x3 xf32 >) -> tensor <13 x21 x3 xf32 >
2121
+ return %0 : tensor <13 x21 x3 xf32 >
2122
+ }
0 commit comments