1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #20107 from sivanov-work:gapi_transpose_op

G-API: Add transpose operation

* Add kernels decl & def

* Add draft for UT

* Fix UT for Transpose

* Add perf test

* Fix docs

* Apply comments
This commit is contained in:
Sergey Ivanov
2021-05-25 20:36:01 +03:00
committed by GitHub
parent 5f637e5a02
commit 2b06208bbd
13 changed files with 140 additions and 0 deletions
@@ -154,6 +154,8 @@ GAPI_TEST_FIXTURE(WarpAffineTest, initMatrixRandU,
GAPI_TEST_FIXTURE(KMeansNDTest, initMatrixRandU, FIXTURE_API(CompareMats, int, cv::KmeansFlags), 3, cmpF, K, flags)
GAPI_TEST_FIXTURE(KMeans2DTest, initNothing, FIXTURE_API(int, cv::KmeansFlags), 2, K, flags)
GAPI_TEST_FIXTURE(KMeans3DTest, initNothing, FIXTURE_API(int, cv::KmeansFlags), 2, K, flags)
GAPI_TEST_FIXTURE(TransposeTest, initMatrixRandU, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_EXT_BASE_FIXTURE(ParseSSDBLTest, ParserSSDTest, initNothing,
FIXTURE_API(float, int), 2, confidence_threshold, filter_label)
@@ -1403,6 +1403,23 @@ TEST_P(KMeans3DTest, AccuracyTest)
kmeansTestBody(in_vector, sz, type, K, flags, getCompileArgs());
}
TEST_P(TransposeTest, Test)
{
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::transpose(in);
cv::GComputation c(in, out);
c.apply(in_mat1, out_mat_gapi, getCompileArgs());
// OpenCV code /////////////////////////////////////////////////////////////
{
cv::transpose(in_mat1, out_mat_ocv);
}
// Comparison //////////////////////////////////////////////////////////////
{
EXPECT_TRUE(cmpF(out_mat_ocv, out_mat_gapi));
}
}
// PLEASE DO NOT PUT NEW ACCURACY TESTS BELOW THIS POINT! //////////////////////
TEST_P(BackendOutputAllocationTest, EmptyOutput)
@@ -542,6 +542,7 @@ struct TestWithParamsSpecific : public TestWithParamsBase<ParamsSpecific<Specifi
* @param ... list of names of user-defined parameters. if there are no parameters, the list
* must be empty.
*/
//TODO: Consider to remove `Number` and use `std::tuple_size<decltype(std::make_tuple(__VA_ARGS__))>::value`
#define GAPI_TEST_FIXTURE(Fixture, InitF, API, Number, ...) \
struct Fixture : public TestWithParams API { \
static_assert(Number == AllParams::specific_params_size, \