ARM-software / ComputeLibrary

The Compute Library is a set of computer vision and machine learning functions optimised for both Arm CPUs and GPUs using SIMD technologies.
MIT License
2.75k stars 767 forks source link

A question in Deconvolution #1019

Closed daoxian closed 8 months ago

daoxian commented 1 year ago

version 22.08, in NEDeconvolutionLayer::validate()

    const unsigned int stride_x     = info.stride().first;
    const unsigned int stride_y     = info.stride().second;
    // Guard against overflows in compute_deconvolution_upsampled_shape()
    const DataLayout   data_layout = input->data_layout();
    const size_t       idx_w       = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
    const size_t       idx_h       = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
    const unsigned int out_x       = (input->dimension(idx_w) - 1) * stride_x + 1;
    const unsigned int out_y       = (input->dimension(idx_h) - 1) * stride_y + 1;
    ARM_COMPUTE_RETURN_ERROR_ON(weights->dimension(idx_w) > out_x);
    ARM_COMPUTE_RETURN_ERROR_ON(weights->dimension(idx_h) > out_y);

I wonder why should weights->dimension(idx_w) <= out_x ? For the simplest example: input (1,1,2,2), weight(1,1,3,3), stride=1, padding=0 and the output shape should be output(1,1,4,4). Then in the validate() out_x should be 2, which < weights->dimension(idx_w), and the validate() will fail

morgolock commented 1 year ago

Hi @daoxian

Would you please share more information about this issue? What's the use case for this configuration input (1,1,2,2), weight(1,1,3,3), stride=1, padding=0 ? What model are you using?

morgolock commented 9 months ago

Hi @daoxian

Please see the following patch fixing the problem https://review.mlplatform.org/c/ml/ComputeLibrary/+/10417

Hope this helps.