Support Softmax op

This commit is contained in:
yumengbo 2024-12-19 03:37:38 +08:00 committed by Mustafa Cavus
parent 590f587b27
commit d218c61e6d
2 changed files with 21 additions and 2 deletions

View File

@ -642,11 +642,28 @@ static const std::set<std::string>& openvino_ops = []() -> const std::set<std::s
return true;
case GGML_OP_MUL_MAT:
return false;
case GGML_OP_SOFT_MAX:
return true;
case GGML_OP_UNARY:
switch (ggml_get_unary_op(op))
{
case GGML_UNARY_OP_SILU:
return true;
case GGML_UNARY_OP_ABS:
case GGML_UNARY_OP_SGN:
case GGML_UNARY_OP_NEG:
case GGML_UNARY_OP_STEP:
case GGML_UNARY_OP_TANH:
case GGML_UNARY_OP_ELU:
case GGML_UNARY_OP_RELU:
case GGML_UNARY_OP_SIGMOID:
case GGML_UNARY_OP_GELU:
case GGML_UNARY_OP_GELU_QUICK:
case GGML_UNARY_OP_HARDSWISH:
case GGML_UNARY_OP_HARDSIGMOID:
case GGML_UNARY_OP_EXP:
case GGML_UNARY_OP_COUNT:
return false;
}
return false;
default:

View File

@ -47,11 +47,13 @@ void GgmlOvDecoder::set_input_output(ggml_tensor* node, std::map<std::string, gg
case GGML_OP_SOFT_MAX:
{
inputs[node->src[0]->name] = node->src[0];
inputs[node->src[1]->name] = node->src[1];
outputs[node->name] = node;
m_input_names.push_back(node->src[0]->name);
m_input_names.push_back(node->src[1]->name);
m_output_names.push_back(node->name);
if (node->src[1]) {
inputs[node->src[1]->name] = node->src[1];
m_input_names.push_back(node->src[1]->name);
}
break;
}
// OPs with 3 inputs: