Skip to content

Commit dc45984

Browse files
committed
mulmat type conversion update
1 parent cafb163 commit dc45984

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ggml/src/ggml-openvino/openvino/op/mulmat.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ OutputVector translate_mulmat(const NodeContext& context) {
3030
ov::Output<Node> res;
3131
ov::Output<ov::Node> B = context.get_input(0);
3232
ov::Output<ov::Node> A = context.get_input(1);
33+
34+
bool convert_out_type = false;
3335
if (ov::op::util::is_constant(B.get_node()) && context.get_input_type(0) != context.get_input_type(1)) {
3436
B = std::make_shared<ov::op::v0::Convert>(context.get_input(0), context.get_input_type(1));
3537
} else if (context.get_input_type(0) != context.get_input_type(1)) {
3638
A = std::make_shared<ov::op::v0::Convert>(context.get_input(1), context.get_input_type(0));
39+
convert_out_type = true;
3740
}
3841

3942
auto B_shape = context.get_input_shape(0).to_shape();
@@ -68,7 +71,12 @@ OutputVector translate_mulmat(const NodeContext& context) {
6871
A = Z;
6972
}
7073

71-
res = std::make_shared<ov::op::v0::MatMul>(A, B, false, true);
74+
if (convert_out_type) {
75+
auto result_lp = std::make_shared<ov::op::v0::MatMul>(A, B, false, true);
76+
res = std::make_shared<ov::op::v0::Convert>(result_lp, context.get_output_type(0));
77+
} else {
78+
res = std::make_shared<ov::op::v0::MatMul>(A, B, false, true);
79+
}
7280

7381
return rename_outputs_with_suffix({res}, context.get_name());
7482
}

0 commit comments

Comments
 (0)