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 / cumsum.cpp
| 1 | #include "../node_context.h" |
| 2 | #include "../op_table.h" |
| 3 | #include "../utils.h" |
| 4 | |
| 5 | #include <openvino/op/constant.hpp> |
| 6 | #include <openvino/op/cum_sum.hpp> |
| 7 | |
| 8 | namespace ov { |
| 9 | namespace frontend { |
| 10 | namespace ggml { |
| 11 | namespace op { |
| 12 | |
| 13 | // GGML cumsum computes prefix sum along dim 0 (the innermost/fastest dimension). |
| 14 | // In OV layout the dims are reversed: ggml [ne0, ne1, ne2, ne3] → OV [ne3, ne2, ne1, ne0], |
| 15 | // so ggml dim 0 maps to OV axis 3 (last axis). |
| 16 | OutputVector translate_cumsum(const NodeContext & context) { |
| 17 | num_inputs_check(context, 1, 1); |
| 18 | |
| 19 | auto x = context.get_input(0); |
| 20 | auto axis = ov::op::v0::Constant::create(ov::element::i64, {}, {3}); |
| 21 | auto res = std::make_shared<ov::op::v0::CumSum>(x, axis); |
| 22 | |
| 23 | return rename_outputs_with_suffix({res}, context.get_name()); |
| 24 | } |
| 25 | |
| 26 | } // namespace op |
| 27 | } // namespace ggml |
| 28 | } // namespace frontend |
| 29 | } // namespace ov |