@@ -243,38 +243,70 @@ func.func @test_reshape_type_mismatch(%arg0 : tensor<13x21x3xf32>) -> () {
243
243
244
244
// -----
245
245
246
- func.func @test_reverse_axis_out_of_range (%arg0 : tensor <13 x 21 x 3 x f32 >) -> () {
247
- // expected-error@+1 {{'tosa.reverse ' op expect input tensor rank (3) to be larger than reverse axis (5) }}
248
- %0 = tosa.reverse %arg0 { axis = 5 : i32 } : (tensor <13 x 21 x 3 x f32 >) -> tensor <?x?x?x i32 >
246
+ func.func @test_reshape_static_zero_dim_input (%arg0 : tensor <13 x 0 x 3 x f32 >) -> () {
247
+ // expected-error@+1 {{'tosa.reshape ' op tensor has a dimension with size zero. Each dimension of a tensor must have size >= 1 }}
248
+ %0 = " tosa.reshape " ( %arg0 ) { new_shape = array< i64 : 13 , 21 , 3 > } : (tensor <13 x 0 x 3 x f32 >) -> tensor <13 x 0 x 3 x f32 >
249
249
return
250
250
}
251
251
252
252
// -----
253
253
254
- func.func @test_const_attribute_type_mismatch () -> tensor <100 x 100 x f32 > {
255
- // expected-error@+1 {{'tosa.const ' op failed to verify that all of {value, output} have same shape }}
256
- %0 = " tosa.const " ( ) {value = dense < 0.000000e+00 > : tensor < 1 x 1 x f32 >} : () -> tensor <100 x 100 x f32 >
257
- return %0 : tensor < 100 x 100 x f32 >
254
+ func.func @test_reshape_zero_dim_input ( %arg0 : tensor <?x 0 x 3 x f32 >) -> () {
255
+ // expected-error@+1 {{'tosa.reshape ' op tensor has a dimension with size zero. Each dimension of a tensor must have size >= 1 }}
256
+ %0 = " tosa.reshape " ( %arg0 ) {new_shape = array< i64 : 13 , 21 , 3 >} : (tensor <?x 0 x 3 x f32 > ) -> tensor <13 x 0 x 3 x f32 >
257
+ return
258
258
}
259
259
260
260
// -----
261
261
262
- func.func @test_reshape_static_zero_dim_input (%arg0 : tensor <13 x 0 x 3 x f32 >) -> () {
263
- // expected-error@+1 {{'tosa.reshape' op tensor has a dimension with size zero. Each dimension of a tensor must have size >= 1 }}
264
- %0 = " tosa.reshape" (%arg0 ) {new_shape = array<i64 : 13 , 21 , 3 >} : (tensor <13 x 0 x 3 x f32 >) -> tensor <13 x 0 x 3 x f32 >
262
+ func.func @test_reshape_rank_mismatch (%arg0 : tensor <?x f32 >) -> () {
263
+ // expected-error@+1 {{'tosa.reshape' op new shape does not match result rank }}
264
+ %0 = " tosa.reshape" (%arg0 ) {new_shape = array<i64 : 2 , 4 >} : (tensor <?x f32 >) -> tensor <?x f32 >
265
265
return
266
266
}
267
267
268
268
// -----
269
269
270
- func.func @test_reshape_zero_dim_input (%arg0 : tensor <?x0 x3 xf32 >) -> () {
271
- // expected-error@+1 {{'tosa.reshape' op tensor has a dimension with size zero. Each dimension of a tensor must have size >= 1}}
272
- %0 = " tosa.reshape" (%arg0 ) {new_shape = array<i64 : 13 , 21 , 3 >} : (tensor <?x0 x3 xf32 >) -> tensor <13 x0 x3 xf32 >
270
+ func.func @test_reshape_inconsistent_result_type (%arg0 : tensor <?xf32 >) -> () {
271
+ // expected-error@+1 {{'tosa.reshape' op new shape is inconsistent with result shape}}
272
+ %0 = " tosa.reshape" (%arg0 ) {new_shape = array<i64 : 2 , 4 , -1 >} : (tensor <?xf32 >) -> tensor <?x3 x5 xf32 >
273
+ return
274
+ }
275
+
276
+ // -----
277
+
278
+ func.func @test_reshape_invalid_size (%arg0 : tensor <2 x4 xf32 >) -> () {
279
+ // expected-error@+1 {{'tosa.reshape' op cannot reshape 8 elements into 15}}
280
+ %0 = " tosa.reshape" (%arg0 ) {new_shape = array<i64 : 3 , 5 >} : (tensor <2 x4 xf32 >) -> tensor <3 x5 xf32 >
281
+ return
282
+ }
283
+
284
+ // -----
285
+
286
+ func.func @test_reshape_invalid_placeholders (%arg0 : tensor <?xf32 >) -> () {
287
+ // expected-error@+1 {{'tosa.reshape' op expected at most one target dimension to be -1}}
288
+ %0 = " tosa.reshape" (%arg0 ) {new_shape = array<i64 : 2 , -1 , -1 >} : (tensor <?xf32 >) -> tensor <2 x?x?xf32 >
273
289
return
274
290
}
275
291
276
292
// -----
277
293
294
+ func.func @test_reverse_axis_out_of_range (%arg0 : tensor <13 x21 x3 xf32 >) -> () {
295
+ // expected-error@+1 {{'tosa.reverse' op expect input tensor rank (3) to be larger than reverse axis (5)}}
296
+ %0 = tosa.reverse %arg0 {axis = 5 : i32 } : (tensor <13 x21 x3 xf32 >) -> tensor <?x?x?xi32 >
297
+ return
298
+ }
299
+
300
+ // -----
301
+
302
+ func.func @test_const_attribute_type_mismatch () -> tensor <100 x100 xf32 > {
303
+ // expected-error@+1 {{'tosa.const' op failed to verify that all of {value, output} have same shape}}
304
+ %0 = " tosa.const" () {value = dense <0.000000e+00 > : tensor <1 x1 xf32 >} : () -> tensor <100 x100 xf32 >
305
+ return %0 : tensor <100 x100 xf32 >
306
+ }
307
+
308
+ // -----
309
+
278
310
func.func @test_conv2d_static_zero_dim_input (%arg0: tensor <1 x29 x0 x4 xf32 >, %arg1: tensor <16 x3 x3 x4 xf32 >, %arg2: tensor <16 xf32 >) -> tensor <1 x27 x27 x16 xf32 > {
279
311
// expected-error@+1 {{'tosa.conv2d' op tensor has a dimension with size zero. Each dimension of a tensor must have size >= 1}}
280
312
%0 = " tosa.conv2d" (%arg0 , %arg1 , %arg2 ) {dilation = array<i64 : 1 , 1 >, pad = array<i64 : 0 , 0 , 0 , 0 >, stride = array<i64 : 1 , 1 >}
0 commit comments