[spec][ref][cpu][gpu]: Added OneHot v16#31901
[spec][ref][cpu][gpu]: Added OneHot v16#31901pkowalc1 merged 48 commits intoopenvinotoolkit:masterfrom
Conversation
…owalc1/openvino into fix_one_hot_negative_indicies
There was a problem hiding this comment.
The code for new operation LGTM. Approved conditionally if the ConvertOneHot16To1 transformation will be fixed and tested in a following PR (or removed from this one). The place and need of the downgrade transformation call should be consulted with NPU plugin, as GPU and CPU is updated.
cc: @openvinotoolkit/openvino-npu-maintainers
src/common/transformations/src/transformations/op_conversions/convert_one_hot_v16_to_v1.cpp
Outdated
Show resolved
Hide resolved
| #include "openvino/op/one_hot.hpp" | ||
| #include "openvino/pass/pattern/op/wrap_type.hpp" | ||
|
|
||
| ov::pass::ConvertOneHot16To1::ConvertOneHot16To1() { |
There was a problem hiding this comment.
This ConvertOneHot16To1 transformation seems to be not tested and never called, (or registered in common transformations like):
But as GPU and CPU plugin is already updated it is likely needed for NPU only.
There was a problem hiding this comment.
OK, I have removed that transformation and I will add it in following pr.
| private: | ||
| friend void inline resolve_axis(OneHotBase* op); |
There was a problem hiding this comment.
In general friends has been removed in ops (looks like missed for this op). It can be removed also as we got get_axis and it can be used in shape inference functions.
| namespace ov { | ||
| namespace op { | ||
| namespace util { |
There was a problem hiding this comment.
As this is new file
| namespace ov { | |
| namespace op { | |
| namespace util { | |
| namespace ov::op::util { |
| namespace ov { | ||
| namespace op { | ||
| namespace util { |
There was a problem hiding this comment.
AS new file added:
| namespace ov { | |
| namespace op { | |
| namespace util { | |
| namespace ov::op::util { |
src/common/transformations/src/transformations/op_conversions/convert_one_hot_v16_to_v1.cpp
Outdated
Show resolved
Hide resolved
| template <typename TOpFunc> | ||
| void OneHotConstantFoldingGenericTest(const TOpFunc& op_func) { |
There was a problem hiding this comment.
| template <typename TOpFunc> | |
| void OneHotConstantFoldingGenericTest(const TOpFunc& op_func) { | |
| template <typename TOneHot> | |
| void OneHotConstantFoldingGenericTest(const TOneHot& one_hot_op) { |
?
| if (none_of(op->get_type_info(), | ||
| op::v1::OneHot::get_type_info_static(), | ||
| op::v16::OneHot::get_type_info_static())) { |
There was a problem hiding this comment.
Maybe check if base class is one hot?
…convert_one_hot_v16_to_v1.cpp Co-authored-by: Katarzyna Mitrus <katarzyna.mitrus@intel.com>
Co-authored-by: Pawel Raasz <pawel.raasz@intel.com>
…convert_one_hot_v16_to_v1.cpp Co-authored-by: Pawel Raasz <pawel.raasz@intel.com>
c3ec20d
Added OneHot v16 operator with with new attribute: negative_indices_mode, with two modes:
Added support of this new op to reference, CPU and GPU implementations, ONNX fronteds, etc. Added new tests/fixed existing.
Tickets: