char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
890f1a27e
char/aliceai-t5-moe
1#include "../node_context.h" 2#include "../op_table.h" 3#include "../utils.h" 4 5#include <memory> 6#include <openvino/frontend/exception.hpp> 7#include <openvino/op/concat.hpp> 8#include <openvino/op/convert.hpp> 9 10namespace ov { 11namespace frontend { 12namespace ggml { 13namespace op { 14 15OutputVector translate_concat (const NodeContext & context ) { 16num_inputs_check (context ,2 ,2 ); 17 18const int32_t * op_params = context .get_output_op_params (); 19FRONT_END_CHECK_IMPLEMENTED (op_params != nullptr ,"CONCAT requires output op params" ); 20 21const auto output_shape = context .get_output_shape (); 22FRONT_END_CHECK_IMPLEMENTED (output_shape .rank ().is_static (),"CONCAT requires static output rank" ); 23 24const auto rank = output_shape .rank ().get_length (); 25const int32_t ggml_dim = op_params [0 ]; 26FRONT_END_CHECK_IMPLEMENTED (ggml_dim >=0 && ggml_dim < rank ,"CONCAT axis is out of range" ); 27 28auto input_0 = process_view_input_new (context ,0 ); 29auto input_1 = process_view_input_new (context ,1 ); 30const auto output_type = context .get_output_type (); 31 32if (input_0 .get_element_type ()!= output_type ) { 33input_0 = std::make_shared < ov::op::v0::Convert > (input_0 ,output_type ); 34 } 35if (input_1 .get_element_type ()!= output_type ) { 36input_1 = std::make_shared < ov::op::v0::Convert > (input_1 ,output_type ); 37 } 38 39const auto axis = static_cast < int64_t > (rank - 1 - ggml_dim ); 40auto res = std::make_shared < ov::op::v0::Concat > (OutputVector {input_0 ,input_1 },axis ); 41 42return rename_outputs_with_suffix ({res },context .get_name ()); 43} 44 45}// namespace op 46}// namespace ggml 47}// namespace frontend 48}// namespace ov