-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
Copy pathpolar.cpp
30 lines (26 loc) · 952 Bytes
/
polar.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "openvino/frontend/complex_type_mark.hpp"
#include "openvino/op/convert.hpp"
#include "openvino/op/cos.hpp"
#include "openvino/op/multiply.hpp"
#include "openvino/op/sin.hpp"
#include "utils.hpp"
namespace ov {
namespace frontend {
namespace pytorch {
namespace op {
using namespace ov::op;
OutputVector translate_polar(const NodeContext& context) {
num_inputs_check(context, 2, 3);
auto abs = context.get_input(0);
auto angle = context.get_input(1);
auto real =
context.mark_node(std::make_shared<v1::Multiply>(abs, context.mark_node(std::make_shared<v0::Cos>(angle))));
auto imag =
context.mark_node(std::make_shared<v1::Multiply>(abs, context.mark_node(std::make_shared<v0::Sin>(angle))));
auto complex_tensor = context.mark_node(std::make_shared<ComplexTypeMark>(real, imag));
return {complex_tensor};
}
} // namespace op
} // namespace pytorch
} // namespace frontend
} // namespace ov