* fix issue #15 and #16 * fix format Co-authored-by: Gheorghe-Teodor Bercea <gt.bercea@gmail.com>
This commit is contained in:
parent
362491553c
commit
6137fc7c17
|
@ -1168,11 +1168,12 @@ static Type padShapeInferenceHelper(Value data, ArrayAttr padsOpt) {
|
||||||
// The two values specify the number of elements padded before and after
|
// The two values specify the number of elements padded before and after
|
||||||
// respectively.
|
// respectively.
|
||||||
for (int i = 0; i < dataRank; ++i) {
|
for (int i = 0; i < dataRank; ++i) {
|
||||||
int64_t p1 = (padsArray[2 * i]).cast<IntegerAttr>().getInt();
|
int64_t p1 = (padsArray[i]).cast<IntegerAttr>().getInt();
|
||||||
int64_t p2 = (padsArray[2 * i + 1]).cast<IntegerAttr>().getInt();
|
int64_t p2 = (padsArray[i + dataRank]).cast<IntegerAttr>().getInt();
|
||||||
// Have to non-negative constant
|
// Have to non-negative constant
|
||||||
if (p1 < 0 || p2 < 0)
|
if (p1 < 0 || p2 < 0)
|
||||||
return (Type)NULL;
|
return (Type)NULL;
|
||||||
|
if (outputShape[i] != -1)
|
||||||
outputShape[i] += p1 + p2;
|
outputShape[i] += p1 + p2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,14 +77,14 @@ func @test_gemm_add_fusion_rank3(%arg0: tensor<128x128x256xf32>, %arg1: tensor<1
|
||||||
// return [[GEMM]] : tensor<*xf32>
|
// return [[GEMM]] : tensor<*xf32>
|
||||||
}
|
}
|
||||||
|
|
||||||
//CHECK-LABEL: @test_maxpoolsingleout_split(%{{.*}}: tensor<5x5x32x32xf32>) -> tensor<5x8x32x39xf32> {
|
//CHECK-LABEL: @test_maxpoolsingleout_split(%{{.*}}: tensor<5x5x32x32xf32>) -> tensor<5x5x36x38xf32> {
|
||||||
func @test_maxpoolsingleout_split(%arg0: tensor<5x5x32x32xf32>) -> tensor<5x8x32x39xf32> {
|
func @test_maxpoolsingleout_split(%arg0: tensor<5x5x32x32xf32>) -> tensor<5x5x36x38xf32> {
|
||||||
%0 = "onnx.MaxPoolSingleOut"(%arg0) {auto_pad = "NOTSET", ceil_mode = 0, kernel_shape = [5,3], pads = [1, 2, 3, 4] } : (tensor<5x5x32x32xf32>) -> tensor<5x8x32x39xf32>
|
%0 = "onnx.MaxPoolSingleOut"(%arg0) {auto_pad = "NOTSET", ceil_mode = 0, kernel_shape = [5,3], pads = [1, 2, 3, 4] } : (tensor<5x5x32x32xf32>) -> tensor<5x5x36x38xf32>
|
||||||
"std.return"(%0) : (tensor<5x8x32x39xf32>) -> ()
|
"std.return"(%0) : (tensor<5x5x36x38xf32>) -> ()
|
||||||
|
|
||||||
// CHECK-NEXT: %0 = "onnx.PadConstantValuePad"(%arg0) {constant_value = 0xFF800000 : f32, mode = "constant", pads = [0, 0, 1, 2, 0, 0, 3, 4]} : (tensor<5x5x32x32xf32>) -> tensor<5x8x32x39xf32>
|
// CHECK-NEXT: %0 = "onnx.PadConstantValuePad"(%arg0) {constant_value = 0xFF800000 : f32, mode = "constant", pads = [0, 0, 1, 2, 0, 0, 3, 4]} : (tensor<5x5x32x32xf32>) -> tensor<5x5x36x38xf32>
|
||||||
// CHECK-NEXT: %1 = "onnx.MaxPoolSingleOut"(%0) {auto_pad = "NOTSET", ceil_mode = 0 : i64, kernel_shape = [5, 3], pads = [0, 0, 0, 0], storage_order = 0 : i64} : (tensor<5x8x32x39xf32>) -> tensor<5x8x32x39xf32>
|
// CHECK-NEXT: %1 = "onnx.MaxPoolSingleOut"(%0) {auto_pad = "NOTSET", ceil_mode = 0 : i64, kernel_shape = [5, 3], pads = [0, 0, 0, 0], storage_order = 0 : i64} : (tensor<5x5x36x38xf32>) -> tensor<5x5x36x38xf32>
|
||||||
// CHECK-NEXT: return %1 : tensor<5x8x32x39xf32>
|
// CHECK-NEXT: return %1 : tensor<5x5x36x38xf32>
|
||||||
}
|
}
|
||||||
|
|
||||||
//CHECK-LABEL: @test_maxpoolsingleout_split_unknown_dims(%{{.*}}: tensor<*xf32>) -> tensor<*xf32> {
|
//CHECK-LABEL: @test_maxpoolsingleout_split_unknown_dims(%{{.*}}: tensor<*xf32>) -> tensor<*xf32> {
|
||||||
|
|
|
@ -280,22 +280,31 @@ func @test_conv_no_bias_11(%arg0 : tensor<1x2x32x64xf32>, %arg1 : tensor<5x2x6x7
|
||||||
|
|
||||||
/// Test PadConstantValuePad_1
|
/// Test PadConstantValuePad_1
|
||||||
func @test_PadConstantValuePad_1(%arg0 : tensor<16x13xf32>) -> tensor<*xf32> {
|
func @test_PadConstantValuePad_1(%arg0 : tensor<16x13xf32>) -> tensor<*xf32> {
|
||||||
%0 = "onnx.PadConstantValuePad"(%arg0) {constant_value = 0.000000e+00 : f32, mode = "constant", pads = [0, 2, 0, 0]} : (tensor<16x13xf32>) -> tensor<*xf32>
|
%0 = "onnx.PadConstantValuePad"(%arg0) {constant_value = 0.000000e+00 : f32, mode = "constant", pads = [0, 0, 2, 0]} : (tensor<16x13xf32>) -> tensor<*xf32>
|
||||||
"std.return"(%0) : (tensor<*xf32>) -> ()
|
"std.return"(%0) : (tensor<*xf32>) -> ()
|
||||||
}
|
}
|
||||||
// CHECK-LABEL: test_PadConstantValuePad_1
|
// CHECK-LABEL: test_PadConstantValuePad_1
|
||||||
// CHECK: [[RES:%.+]] = "onnx.PadConstantValuePad"(%arg0) {constant_value = 0.000000e+00 : f32, mode = "constant", pads = [0, 2, 0, 0]} : (tensor<16x13xf32>) -> tensor<18x13xf32>
|
// CHECK: [[RES:%.+]] = "onnx.PadConstantValuePad"(%arg0) {constant_value = 0.000000e+00 : f32, mode = "constant", pads = [0, 0, 2, 0]} : (tensor<16x13xf32>) -> tensor<18x13xf32>
|
||||||
// CHECK: return [[RES]] : tensor<18x13xf32>
|
// CHECK: return [[RES]] : tensor<18x13xf32>
|
||||||
|
|
||||||
/// Test PadConstantPad_1
|
/// Test PadConstantPad_1
|
||||||
func @test_PadConstantPad_1(%arg0 : tensor<16x13xf32>, %arg1 : tensor<*xf32>) -> tensor<*xf32> {
|
func @test_PadConstantPad_1(%arg0 : tensor<16x13xf32>, %arg1 : tensor<*xf32>) -> tensor<*xf32> {
|
||||||
%0 = "onnx.PadConstantPad"(%arg0, %arg1) {mode = "constant", pads = [0, 2, 3, 1]} : (tensor<16x13xf32>, tensor<*xf32>) -> tensor<*xf32>
|
%0 = "onnx.PadConstantPad"(%arg0, %arg1) {mode = "constant", pads = [0, 3, 2, 1]} : (tensor<16x13xf32>, tensor<*xf32>) -> tensor<*xf32>
|
||||||
"std.return"(%0) : (tensor<*xf32>) -> ()
|
"std.return"(%0) : (tensor<*xf32>) -> ()
|
||||||
}
|
}
|
||||||
// CHECK-LABEL: test_PadConstantPad_1
|
// CHECK-LABEL: test_PadConstantPad_1
|
||||||
// CHECK: [[RES:%.+]] = "onnx.PadConstantPad"(%arg0, %arg1) {mode = "constant", pads = [0, 2, 3, 1]} : (tensor<16x13xf32>, tensor<*xf32>) -> tensor<18x17xf32>
|
// CHECK: [[RES:%.+]] = "onnx.PadConstantPad"(%arg0, %arg1) {mode = "constant", pads = [0, 3, 2, 1]} : (tensor<16x13xf32>, tensor<*xf32>) -> tensor<18x17xf32>
|
||||||
// CHECK: return [[RES]] : tensor<18x17xf32>
|
// CHECK: return [[RES]] : tensor<18x17xf32>
|
||||||
|
|
||||||
|
/// Test PadConstantPad_2
|
||||||
|
func @test_PadConstantPad_2(%arg0 : tensor<16x?xf32>, %arg1 : tensor<*xf32>) -> tensor<*xf32> {
|
||||||
|
%0 = "onnx.PadConstantPad"(%arg0, %arg1) {mode = "constant", pads = [0, 3, 2, 1]} : (tensor<16x?xf32>, tensor<*xf32>) -> tensor<*xf32>
|
||||||
|
"std.return"(%0) : (tensor<*xf32>) -> ()
|
||||||
|
}
|
||||||
|
// CHECK-LABEL: test_PadConstantPad_2
|
||||||
|
// CHECK: [[RES:%.+]] = "onnx.PadConstantPad"(%arg0, %arg1) {mode = "constant", pads = [0, 3, 2, 1]} : (tensor<16x?xf32>, tensor<*xf32>) -> tensor<18x?xf32>
|
||||||
|
// CHECK: return [[RES]] : tensor<18x?xf32>
|
||||||
|
|
||||||
/// Test ConstantOp shape inference for 1-D dense tensor.
|
/// Test ConstantOp shape inference for 1-D dense tensor.
|
||||||
func @test_constant_dense_1d_value() -> tensor<*xf32> {
|
func @test_constant_dense_1d_value() -> tensor<*xf32> {
|
||||||
%0 = "onnx.Constant"() {value = dense<[0.0, 1.0, 2.0]> : tensor<3xf32>} : () -> tensor<*xf32>
|
%0 = "onnx.Constant"() {value = dense<[0.0, 1.0, 2.0]> : tensor<3xf32>} : () -> tensor<*xf32>
|
||||||
|
|
Loading…
Reference in New Issue