ggml
[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)
Brought by drakestapleton
ggml / src / ggml-openvino / openvino / op / roll.cpp
| 1 | #include "../node_context.h" |
| 2 | #include "../op_table.h" |
| 3 | #include "../utils.h" |
| 4 | |
| 5 | #include <openvino/op/roll.hpp> |
| 6 | #include <openvino/op/constant.hpp> |
| 7 | |
| 8 | namespace ov { |
| 9 | namespace frontend { |
| 10 | namespace ggml { |
| 11 | namespace op { |
| 12 | |
| 13 | OutputVector translate_roll(const NodeContext & context) { |
| 14 | num_inputs_check(context, 1, 1); |
| 15 | const int32_t * params = context.get_output_op_params(); |
| 16 | |
| 17 | int64_t s0 = params[0]; |
| 18 | int64_t s1 = params[1]; |
| 19 | int64_t s2 = params[2]; |
| 20 | int64_t s3 = params[3]; |
| 21 | |
| 22 | auto input = context.get_input(0); |
| 23 | |
| 24 | auto shift = ov::op::v0::Constant::create( |
| 25 | ov::element::i64, ov::Shape{4}, std::vector<int64_t>{s3, s2, s1, s0}); |
| 26 | auto axes = ov::op::v0::Constant::create( |
| 27 | ov::element::i64, ov::Shape{4}, std::vector<int64_t>{0, 1, 2, 3}); |
| 28 | |
| 29 | auto roll = std::make_shared<ov::op::v7::Roll>(input, shift, axes); |
| 30 | return rename_outputs_with_suffix({roll}, context.get_name()); |
| 31 | } |
| 32 | |
| 33 | } // namespace op |
| 34 | } // namespace ggml |
| 35 | } // namespace frontend |
| 36 | } // namespace ov |