-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GPU] Add new operation GatherElements to IE clDNN plugin #6676
[GPU] Add new operation GatherElements to IE clDNN plugin #6676
Conversation
inference-engine/thirdparty/clDNN/tests/test_cases/gather_elements_gpu_test.cpp
Outdated
Show resolved
Hide resolved
auto outLayout = DefaultFormatForDims(op->get_output_shape(0).size()); | ||
|
||
auto primitive = cldnn::gather_elements(layerName, | ||
inputPrimitives[0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: please align args
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
||
REGISTER_FACTORY_IMPL(v6, GatherElements); | ||
|
||
} // namespace CLDNNPlugin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: please add newline in eof
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@@ -0,0 +1,71 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use new copyright message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
const primitive_id& indices, | ||
const format& output_format, | ||
const tensor& output_shape, | ||
// const uint8_t axis = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove dead code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
size_t outer_sum = (out_idx / outer_sum_inc_indices) * outer_sum_inc_data; | ||
size_t inner_sum = out_idx % max_inner_sum; | ||
if (indices[out_idx] < 0 || indices[out_idx] >= data_shape[AXIS]) { | ||
printf("indices values of GatherElement exceed data size.\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove debug code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
||
#define GET_UPDATES_INDEX(prefix, idx_order) CAT(prefix, _GET_INDEX)(idx_order) | ||
|
||
KERNEL(gather_nd_ref)(const __global INPUT0_TYPE* data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gather_nd_ref -> gather_elements_ref
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
#include "shared_test_classes/single_layer/gather_elements.hpp" | ||
|
||
namespace LayerTestsDefinitions { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it empty? I assume here should be test definition like TEST_P(GatherElementsLayerTest, CompareWithRefs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That test definition is already in inference-engine/tests/functional/shared_test_classes/src/single_layer/gather_elements.cpp
file.
So I didn't add that code to avoid dupicate declarations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iefode What is the expected location of test definitions? I see that most of the layers have test definition in inference-engine/tests/functional/plugin/shared/include/single_layer_tests/*.hpp
, so I'd expect that gather_elements will be defined in similar way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the location of the test definition from inference-engine/tests/functional/shared_test_classes/src/single_layer/gather_elements.cpp
to inference-engine/tests/functional/plugin/shared/include/single_layer_tests/gather_elements.hpp
.
And, Fixed header in inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/gather_elements.cpp
file.
inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/gather_elements_ref.cl
Outdated
Show resolved
Hide resolved
...e/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_ref.cpp
Show resolved
Hide resolved
4769f32
to
7d1334b
Compare
- fix shpae error. - add rank=4,5,6 test cases. - change gws and lws setting.
- Resolve conflicts. - Change file location.
dfd6ef9
to
d36aa7e
Compare
/// @param output_shape Output shape. | ||
/// @param axis Gathering axis. | ||
gather_elements(const primitive_id& id, | ||
const primitive_id& data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: alignment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed it.
FLOAT16(2), FLOAT16(10), FLOAT16(7), FLOAT16(3), FLOAT16(3), FLOAT16(10), FLOAT16(6), FLOAT16(1), | ||
}; | ||
|
||
DoTest(engine,input0, input1, expected_results, tensor(2, 2, 8, 3), axis); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add space after "engine," here and in other calls of the function DoTest.
DoTest(engine, input0, input1, expected_results, tensor(2, 2, 8, 3), axis);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed them all.
baf20ad
to
306c093
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR looks good to me.
...ne/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/gather_elements.cpp
Outdated
Show resolved
Hide resolved
...ne/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/gather_elements.cpp
Outdated
Show resolved
Hide resolved
...ne/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/gather_elements.cpp
Show resolved
Hide resolved
inference-engine/thirdparty/clDNN/api/cldnn/primitives/gather_elements.hpp
Outdated
Show resolved
Hide resolved
inference-engine/thirdparty/clDNN/kernel_selector/common/common_types.h
Outdated
Show resolved
Hide resolved
...hirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_selector.h
Outdated
Show resolved
Hide resolved
...e/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_ref.cpp
Show resolved
Hide resolved
inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/gather_elements_ref.cl
Show resolved
Hide resolved
inference-engine/thirdparty/clDNN/src/impls/ocl/gather_elements.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for me
...ne/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/gather_elements.cpp
Outdated
Show resolved
Hide resolved
b36cb1a
to
faa7c82
Compare
#include "shared_test_classes/single_layer/gather_elements.hpp" | ||
|
||
namespace LayerTestsDefinitions { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iefode What is the expected location of test definitions? I see that most of the layers have test definition in inference-engine/tests/functional/plugin/shared/include/single_layer_tests/*.hpp
, so I'd expect that gather_elements will be defined in similar way.
@@ -73,4 +73,4 @@ INSTANTIATE_TEST_SUITE_P(smoke_set5, GatherElementsLayerTest, | |||
::testing::ValuesIn(iPrecisions), | |||
::testing::Values(CommonTestUtils::DEVICE_CPU)), | |||
GatherElementsLayerTest::getTestCaseName); | |||
} // namespace | |||
} // namespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert it please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll create new PR for this.
/// @} | ||
/// @} | ||
/// @} | ||
} // namespace cldnn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: please add new line in eof (here and in other places). I'd recommend to setup your IDE to add it automatically on save
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for telling me. I added new line from the last commit.
|
||
GatherElementsAxis axis; | ||
|
||
virtual ParamsKey GetParamsKey() const { return base_params::GetParamsKey(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this method doesn't change the behavior of base one, then you should not define it at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it.
…envinotoolkit#6676)" This reverts commit f5666fb.
…envinotoolkit#6676)" This reverts commit f5666fb.
Revert "[GPU] Add new operation GatherElements to IE clDNN plugin (openvinotoolkit#6676)" This reverts commit f5666fb.
Description
Added new operation: GatherElements
Tickets: