|
| 1 | +// RUN: mlir-opt %s -split-input-file -verify-diagnostics |
| 2 | + |
| 3 | + |
| 4 | +func @test_conv2d(%arg0: tensor<1x29x29x4xf32>, %arg1: tensor<16x3x3x4xi8>, %arg2: tensor<16xi8>) -> tensor<1x27x27x16xi8> { |
| 5 | + // expected-error@+1 {{expect both input and weight to be float or not together, got 'f32' and 'i8'}} |
| 6 | + %0 = "tosa.conv2d"(%arg0, %arg1, %arg2) {dilation = [1, 1], pad = [0, 0, 0, 0], stride = [1, 1]} |
| 7 | + : (tensor<1x29x29x4xf32>, tensor<16x3x3x4xi8>, tensor<16xi8>) -> tensor<1x27x27x16xi8> |
| 8 | + return %0 : tensor<1x27x27x16xi8> |
| 9 | +} |
| 10 | + |
| 11 | +// ----- |
| 12 | + |
| 13 | +func @test_conv2d(%arg0: tensor<*xi8>, %arg1: tensor<16x3x3x4xi8>, %arg2: tensor<16xi8>) -> tensor<1x27x27x16xi8> { |
| 14 | + // expected-error@+1 {{expect a ranked tensor for input, got <block argument> of type 'tensor<*xi8>' at index: 0}} |
| 15 | + %0 = "tosa.conv2d"(%arg0, %arg1, %arg2) {dilation = [1, 1], pad = [0, 0, 0, 0], stride = [1, 1]} |
| 16 | + : (tensor<*xi8>, tensor<16x3x3x4xi8>, tensor<16xi8>) -> tensor<1x27x27x16xi8> |
| 17 | + return %0 : tensor<1x27x27x16xi8> |
| 18 | +} |
| 19 | + |
| 20 | +// ----- |
| 21 | + |
| 22 | +func @test_conv2d(%arg0: tensor<1x29x29x4xi8>, %arg1: tensor<*xi8>, %arg2: tensor<16xi8>) -> tensor<1x27x27x16xi8> { |
| 23 | + // expected-error@+1 {{expect a ranked tensor for weight, got <block argument> of type 'tensor<*xi8>' at index: 1}} |
| 24 | + %0 = "tosa.conv2d"(%arg0, %arg1, %arg2) {dilation = [1, 1], pad = [0, 0, 0, 0], stride = [1, 1]} |
| 25 | + : (tensor<1x29x29x4xi8>, tensor<*xi8>, tensor<16xi8>) -> tensor<1x27x27x16xi8> |
| 26 | + return %0 : tensor<1x27x27x16xi8> |
| 27 | +} |
| 28 | + |
| 29 | + |
| 30 | +// ----- |
| 31 | + |
| 32 | +func @test_conv2d(%arg0: tensor<1x29x29x4xi8>, %arg1: tensor<16x3x3x4xi8>, %arg2: tensor<16xi8>) -> tensor<1x27x27x16xi8> { |
| 33 | + // expected-error@+1 {{'tosa.conv2d' op quantizationattr is required for quantized type, and not allowed for float type}} |
| 34 | + %0 = "tosa.conv2d"(%arg0, %arg1, %arg2) {dilation = [1, 1], pad = [0, 0, 0, 0], stride = [1, 1]} |
| 35 | + : (tensor<1x29x29x4xi8>, tensor<16x3x3x4xi8>, tensor<16xi8>) -> tensor<1x27x27x16xi8> |
| 36 | + return %0 : tensor<1x27x27x16xi8> |
| 37 | +} |
| 38 | + |
| 39 | + |
0 commit comments