Problem with deconvolution layer validation
Closed this issue · 5 comments
Hello!
When I use deconvolution validate function I catch exception instead check status:
This code:
unsigned int pad_l = 0;
unsigned int pad_r = 5;
unsigned int pad_t = 0;
unsigned int pad_b = 7;
unsigned int stride_x = 1;
unsigned int stride_y = 1;
PadStrideInfo deconv_info(stride_x, stride_y, pad_l, pad_r, pad_t, pad_b,DimensionRoundingType::FLOOR);
Status status = NEDeconvolutionLayer::validate(&srcTensorInfo, &weiTensorInfo, nullptr, &dstTensorInfo, deconv_info);
if (!status) {
std::cout << status.error_description() << std::endl;
return false;
}
Layout - NCHW
Precision - F32
And receive message:
in deconvolution_output_dimensions src/core/Utils.cpp:422: ((in_height - 1) * stride_y + kernel_height) < (pad_top + pad_bottom)
Why status of error description doesn't work?
Hi @allnes
Could you please share the code initializing all the tensors including the shapes? I tried to reproduce but I'm missing srcTensorInfo
, weiTensorInfo
and dstTensorIn
Hi,
this example create problem with exception:
TensorInfo srcTensorInfo = TensorInfo({7, 7, 12, 1}, 1, F32, NCHW);
TensorInfo weiTensorInfo = TensorInfo({3, 3, 6, 12}, 1, F32, NCHW);
TensorInfo dstTensorInfo = TensorInfo({15, 15, 6, 1}, 1, F32, NCHW);
And I have question, do you support negative pads?
Hi @allnes
I tried the shapes with a new build using the latest main and I don't get the exception
1 #include "arm_compute/core/Types.h"
2 #include "utils/Utils.h"
3 #include "tests/SimpleTensor.h"
4 #include "arm_compute/runtime/NEON/functions/NEDeconvolutionLayer.h"
5
6
7 using namespace std;
8 using namespace arm_compute;
9 using namespace arm_compute::test;
10
11
12
13 int main()
14 {
15
16 TensorInfo srcTensorInfo = TensorInfo({7, 7, 12, 1}, 1, DataType::F32, DataLayout::NCHW);
17 TensorInfo weiTensorInfo = TensorInfo({3, 3, 6, 12}, 1, DataType::F32, DataLayout::NCHW);
18 TensorInfo dstTensorInfo = TensorInfo({15, 15, 6, 1}, 1, DataType::F32, DataLayout::NCHW);
19 unsigned int pad_l = 0;
20 unsigned int pad_r = 5;
21 unsigned int pad_t = 0;
22 unsigned int pad_b = 7;
23 unsigned int stride_x = 1;
24 unsigned int stride_y = 1;
25
26 PadStrideInfo padinfo(stride_x, stride_y, pad_l, pad_r, pad_t, pad_b,DimensionRoundingType::FLOOR);
27
28 const auto status = NEDeconvolutionLayer::validate(&srcTensorInfo, &weiTensorInfo,0, &dstTensorInfo,padinfo);
29 std::cout << "validate " << bool(status) << " " << status.error_description() << std::endl;
30
31 return 0;
32 }
When I run the program I get
# LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./test_deconv_validate
validate 0 in validate src/runtime/NEON/functions/NEDeconvolutionLayer.cpp:145: Output's width is invalid.
What version of ACL are you using?
Deconvolution does not support negative padding.
Hope this helps.
Hi @allnes
I tried the shapes with a new build using the latest main and I don't get the exception
1 #include "arm_compute/core/Types.h" 2 #include "utils/Utils.h" 3 #include "tests/SimpleTensor.h" 4 #include "arm_compute/runtime/NEON/functions/NEDeconvolutionLayer.h" 5 6 7 using namespace std; 8 using namespace arm_compute; 9 using namespace arm_compute::test; 10 11 12 13 int main() 14 { 15 16 TensorInfo srcTensorInfo = TensorInfo({7, 7, 12, 1}, 1, DataType::F32, DataLayout::NCHW); 17 TensorInfo weiTensorInfo = TensorInfo({3, 3, 6, 12}, 1, DataType::F32, DataLayout::NCHW); 18 TensorInfo dstTensorInfo = TensorInfo({15, 15, 6, 1}, 1, DataType::F32, DataLayout::NCHW); 19 unsigned int pad_l = 0; 20 unsigned int pad_r = 5; 21 unsigned int pad_t = 0; 22 unsigned int pad_b = 7; 23 unsigned int stride_x = 1; 24 unsigned int stride_y = 1; 25 26 PadStrideInfo padinfo(stride_x, stride_y, pad_l, pad_r, pad_t, pad_b,DimensionRoundingType::FLOOR); 27 28 const auto status = NEDeconvolutionLayer::validate(&srcTensorInfo, &weiTensorInfo,0, &dstTensorInfo,padinfo); 29 std::cout << "validate " << bool(status) << " " << status.error_description() << std::endl; 30 31 return 0; 32 }
When I run the program I get
# LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./test_deconv_validate validate 0 in validate src/runtime/NEON/functions/NEDeconvolutionLayer.cpp:145: Output's width is invalid.
What version of ACL are you using?
Deconvolution does not support negative padding.
Hope this helps.
Hi, @morgolock
Thanks for your reply, I will try to prepare a reproducer that shows the original error I found. When I do, I will post in this task.
ACL version was 23.08.
I closed this issue because when I rechecked this case, I saw that we set negative values in unsigned int and get unpredictable behaviour.