char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Zijun YuOpenVINO: Update OV to 2026.3.1, whisper.cpp support, Qwen3.5 on NPU, and new ops (#27843)511f9c137

char/aliceai-t5-moe
1.5 KiB53 linesraw
1#include "../node_context.h"
2#include "../op_table.h"
3#include "../utils.h"
4
5#include <openvino/op/avg_pool.hpp>
6#include <openvino/op/max_pool.hpp>
7#include <openvino/op/convert.hpp>
8
9namespace ov {
10namespace frontend {
11namespace ggml {
12namespace op {
13
14OutputVector translate_pool_2d(const NodeContext & context) {
15    num_inputs_check(context, 1, 1);
16    const int32_t * params = context.get_output_op_params();
17
18    const int k0 = params[1];
19    const int k1 = params[2];
20    const int s0 = params[3];
21    const int s1 = params[4];
22    const int p0 = params[5];
23    const int p1 = params[6];
24
25    const int op_case = context.get_op_case();
26    ov::Output<Node> input = context.get_input(0);
27    ov::Strides strides{static_cast<size_t>(s1), static_cast<size_t>(s0)};
28    ov::Shape pads_begin{static_cast<size_t>(p1), static_cast<size_t>(p0)};
29    ov::Shape pads_end{static_cast<size_t>(p1), static_cast<size_t>(p0)};
30    ov::Shape kernel{static_cast<size_t>(k1), static_cast<size_t>(k0)};
31    ov::Output<Node> res;
32
33    switch (op_case) {
34    case 1:  // GGML_OP_POOL_MAX
35    {
36        res = std::make_shared<ov::op::v1::MaxPool>(input, strides, pads_begin, pads_end, kernel);
37        break;
38    }
39    case 2:  // GGML_OP_POOL_AVG
40    {
41        res = std::make_shared<ov::op::v1::AvgPool>(input, strides, pads_begin, pads_end, kernel, false);
42        break;
43    }
44    default:
45        break;
46    }
47    return rename_outputs_with_suffix({res}, context.get_name());
48}
49
50}  // namespace op
51}  // namespace ggml
52}  // namespace frontend
53}  // namespace ov