[PT FE] Add aten::__xor__ (#20662)

* Add __xor__

* Add xor tests

* add more xfail tests

* Update src/frontends/pytorch/src/op_table.cpp

Co-authored-by: Maxim Vafin <maxim.vafin@intel.com>

* Update src/frontends/pytorch/src/op_table.cpp

Co-authored-by: Maxim Vafin <maxim.vafin@intel.com>

* fix code style

---------

Co-authored-by: Maxim Vafin <maxim.vafin@intel.com>
This commit is contained in:
Karan JakharandMaxim Vafin authored and GitHub committed 2023-10-26 18:28:47 +04:00
1 parent 7720135f58
commit 26632d1cd9
3 files changed
+100

No files matched your search

+11
View File
@@ -6,6 +6,7 @@
#include "openvino/op/logical_and.hpp"
#include "openvino/op/logical_not.hpp"
#include "openvino/op/logical_or.hpp"
#include "openvino/op/logical_xor.hpp"
#include "utils.hpp"
namespace ov {
@@ -45,6 +46,16 @@ OutputVector translate_bitwise_or(const NodeContext& context) {
return {or_x};
};
OutputVector translate_bitwise_xor(const NodeContext& context) {
num_inputs_check(context, 2, 2);
auto x = context.get_input(0);
auto y = context.get_input(1);
FRONT_END_OP_CONVERSION_CHECK(x.get_element_type().compatible(element::boolean),
"aten::bitwise_xor supported only for boolean input");
auto xor_x = context.mark_node(std::make_shared<ov::op::v1::LogicalXor>(x, y));
return {xor_x};
};
} // namespace op
} // namespace pytorch
} // namespace frontend
+2
View File
@@ -131,6 +131,7 @@ OP_CONVERTER(translate_one_hot);
OP_CONVERTER(translate_ones);
OP_CONVERTER(translate_ones_like);
OP_CONVERTER(translate_or);
OP_CONVERTER(translate_bitwise_xor);
OP_CONVERTER(translate_outer);
OP_CONVERTER(translate_pad);
OP_CONVERTER(translate_pairwise_distance);
@@ -233,6 +234,7 @@ const std::map<std::string, CreatorFunction> get_supported_ops_ts() {
{"aten::__getitem__", op::translate_getitem},
{"aten::__not__", op::translate_1to1_match_1_inputs<opset10::LogicalNot>},
{"aten::__or__", op::translate_or},
{"aten::__xor__", op::translate_bitwise_xor},
{"aten::__range_length", op::translate_range_length},
{"aten::_convolution", op::translate_convolution},
{"aten::_convolution_mode", op::translate_convolution_mode},