File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -682,6 +682,10 @@ LogicalResult tosa::PadOp::inferReturnTypeComponents(
682
682
683
683
LogicalResult PadOp::verify () {
684
684
ShapedType inputType = llvm::cast<ShapedType>(getInput1 ().getType ());
685
+ if (inputType.hasRank () && inputType.getRank () == 0 ) {
686
+ return emitOpError () << " input tensor rank must not be 0" ;
687
+ }
688
+
685
689
ShapedType paddingType = llvm::cast<ShapedType>(getPadding ().getType ());
686
690
if (paddingType.hasRank ()) {
687
691
if (paddingType.getRank () != 2 ) {
Original file line number Diff line number Diff line change @@ -171,6 +171,22 @@ func.func @test_pad_negative_padding(%arg0: tensor<13x21xf32>) -> tensor<?x?xf32
171
171
172
172
// -----
173
173
174
+ func.func @test_pad_incorrect_input (%arg0: f32 , %arg1: i32 ) -> f32 {
175
+ // expected-error@+1 {{'tosa.pad' op operand #0 must be ranked tensor of number values, but got 'f32'}}
176
+ %1 = " tosa.pad" (%arg0 , %arg1 ) : (f32 , i32 ) -> f32
177
+ return %1 : f32
178
+ }
179
+
180
+ // -----
181
+
182
+ func.func @test_pad_zero_rank_input (%arg0: tensor <f32 >, %arg1: tensor <i32 >) -> tensor <f32 > {
183
+ // expected-error@+1 {{'tosa.pad' op input tensor rank must not be 0}}
184
+ %1 = " tosa.pad" (%arg0 , %arg1 ) : (tensor <f32 >, tensor <i32 >) -> tensor <f32 >
185
+ return %1 : tensor <f32 >
186
+ }
187
+
188
+ // -----
189
+
174
190
func.func @test_transpose_non_const (%arg0: tensor <13 x21 x3 xf32 >, %arg1: tensor <3 xi32 >) -> tensor <3 x13 x21 xf32 > {
175
191
// expected-error@+1 {{'tosa.transpose' op perms of transpose is not constant}}
176
192
%0 = " tosa.transpose" (%arg0 , %arg1 ) : (tensor <13 x21 x3 xf32 >, tensor <3 xi32 >) -> tensor <3 x13 x21 xf32 >
You can’t perform that action at this time.
0 commit comments