1212#include < openvino/op/slice.hpp>
1313#include < openvino/op/transpose.hpp>
1414#include < openvino/op/unsqueeze.hpp>
15+ #include < openvino/op/util/op_types.hpp>
1516#include < vector>
1617
1718#include " ../node_context.hpp"
@@ -28,7 +29,15 @@ OutputVector translate_mulmat(const NodeContext& context) {
2829
2930 ov::Output<Node> res;
3031 ov::Output<ov::Node> B = context.get_input (0 );
31- ov::Output<ov::Node> A = std::make_shared<ov::op::v0::Convert>(context.get_input (1 ), context.get_input_type (0 ));
32+ ov::Output<ov::Node> A = context.get_input (1 );
33+
34+ bool convert_out_type = false ;
35+ if (ov::op::util::is_constant (B.get_node ()) && context.get_input_type (0 ) != context.get_input_type (1 )) {
36+ B = std::make_shared<ov::op::v0::Convert>(context.get_input (0 ), context.get_input_type (1 ));
37+ } else if (context.get_input_type (0 ) != context.get_input_type (1 )) {
38+ A = std::make_shared<ov::op::v0::Convert>(context.get_input (1 ), context.get_input_type (0 ));
39+ convert_out_type = true ;
40+ }
3241
3342 auto B_shape = context.get_input_shape (0 ).to_shape ();
3443 auto A_shape = context.get_input_shape (1 ).to_shape ();
@@ -62,8 +71,12 @@ OutputVector translate_mulmat(const NodeContext& context) {
6271 A = Z;
6372 }
6473
65- auto result_lp = std::make_shared<ov::op::v0::MatMul>(A, B, false , true );
66- res = std::make_shared<ov::op::v0::Convert>(result_lp, context.get_output_type (0 ));
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+ }
6780
6881 return rename_outputs_with_suffix ({res}, context.get_name ());
6982}
0 commit comments