Skip to content

G-API: Added reshape() functionality to CPU backend#21669

Merged
opencv-pushbot merged 1 commit intoopencv:4.xfrom
rgarnov:rg/cpu_backend_reshape
Mar 9, 2022
Merged

G-API: Added reshape() functionality to CPU backend#21669
opencv-pushbot merged 1 commit intoopencv:4.xfrom
rgarnov:rg/cpu_backend_reshape

Conversation

@rgarnov
Copy link
Copy Markdown
Contributor

@rgarnov rgarnov commented Mar 1, 2022

Summary

  • Added reshape functionality to CPU backend
  • Fixed fluid heterogeneous reshape

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

Build configuration

force_builders=Custom,Custom Win,Custom Mac
build_gapi_standalone:Linux x64=ade-0.1.1f
build_gapi_standalone:Win64=ade-0.1.1f
build_gapi_standalone:Mac=ade-0.1.1f
build_gapi_standalone:Linux x64 Debug=ade-0.1.1f

Xbuild_image:Custom=centos:7
Xbuildworker:Custom=linux-1
build_gapi_standalone:Custom=ade-0.1.1f

build_image:Custom=ubuntu-openvino-2021.4.1:20.04
build_image:Custom Win=openvino-2021.4.1
build_image:Custom Mac=openvino-2021.4.1

test_modules:Custom=gapi,python2,python3,java
test_modules:Custom Win=gapi,python2,python3,java
test_modules:Custom Mac=gapi,python2,python3,java

buildworker:Custom=linux-1
# disabled due high memory usage: test_opencl:Custom=ON
test_opencl:Custom=OFF
test_bigdata:Custom=1
test_filter:Custom=*

Copy link
Copy Markdown
Contributor

@AsyaPronina AsyaPronina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to expand tests for stateful kernels with reshape test?

@rgarnov rgarnov force-pushed the rg/cpu_backend_reshape branch from ee2cfd3 to 3d46ee2 Compare March 2, 2022 22:35
@rgarnov
Copy link
Copy Markdown
Contributor Author

rgarnov commented Mar 2, 2022

Do we need to expand tests for stateful kernels with reshape test?

@AsyaPronina, added an appropriate test, thanks!

// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2018-2020 Intel Corporation
// Copyright (C) 2018-2021 Intel Corporation
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

}
}

void cv::gimpl::GCPUExecutable::reshape(ade::Graph&, const GCompileArgs&) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, it's needed to handle GCompileArgs as well, because stateful kernels use them:
https://github.com/opencv/opencv/blob/4.x/modules/gapi/src/backends/cpu/gcpubackend.cpp#L175

I'd propose to add test on that case

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@rgarnov rgarnov force-pushed the rg/cpu_backend_reshape branch from 3d46ee2 to 06084a8 Compare March 4, 2022 18:53
@rgarnov rgarnov force-pushed the rg/cpu_backend_reshape branch from 06084a8 to 3203393 Compare March 5, 2022 09:54
@rgarnov rgarnov force-pushed the rg/cpu_backend_reshape branch from 3203393 to ecb3040 Compare March 5, 2022 11:21
@rgarnov rgarnov requested a review from dmatveev March 5, 2022 12:53
@dmatveev dmatveev self-assigned this Mar 8, 2022
@dmatveev dmatveev added this to the 4.6.0 milestone Mar 8, 2022
Copy link
Copy Markdown
Contributor

@dmatveev dmatveev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 overall LGTM

}
}

makeReshape();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this method call should be commented in the same way as the below one -- to clearly outline its intention and why it is here.

Copy link
Copy Markdown
Contributor

@AsyaPronina AsyaPronina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your efforts!!

@AsyaPronina
Copy link
Copy Markdown
Contributor

Do we need to expand tests for stateful kernels with reshape test?

@AsyaPronina, added an appropriate test, thanks!

Thanks a lot, perfect tests!!

@rgarnov
Copy link
Copy Markdown
Contributor Author

rgarnov commented Mar 9, 2022

@alalek could you proceed with the merge please?

@opencv-pushbot opencv-pushbot merged commit 852904e into opencv:4.x Mar 9, 2022
@opencv-pushbot opencv-pushbot mentioned this pull request Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants