Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[GPU] Fix different element types of MatMul dequantization scales issue (#27077)

yuanxion308b420dde92
diff --git a/src/common/low_precision_transformations/src/mat_mul.cpp b/src/common/low_precision_transformations/src/mat_mul.cpp
index 15afe2408cc..705f3d400a0 100644
--- a/src/common/low_precision_transformations/src/mat_mul.cpp
+++ b/src/common/low_precision_transformations/src/mat_mul.cpp
@@ -160,7 +160,7 @@ bool MatMulTransformation::transform(TransformationContext &context, ov::pass::p
}
const auto newMulConst = NetworkHelper::toScalarIfPossible(fold<ov::opset1::Multiply>(
- mulConst1,
+ foldConvert(mulConst1, element::f32),
foldConvert(mulConst2, element::f32)));
const auto newMultiply = std::make_shared<ov::op::TypeRelaxed<ov::opset1::Multiply>>(
diff --git a/src/common/low_precision_transformations/tests/mat_mul_with_constant_transformation.cpp b/src/common/low_precision_transformations/tests/mat_mul_with_constant_transformation.cpp
index 454802c965f..8425db39808 100644
--- a/src/common/low_precision_transformations/tests/mat_mul_with_constant_transformation.cpp
+++ b/src/common/low_precision_transformations/tests/mat_mul_with_constant_transformation.cpp
@@ -157,6 +157,22 @@ std::vector<MatMullTransformationTestValues> testValues = {
{},
{}}},
+ // test: multiply with f16 constant
+ {LayerTransformation::createParamsU8I8(),
+ {ov::element::u8,
+ {ov::element::f32, {}, ov::builder::subgraph::DequantizationOperations::Multiply{0.02f}.setConstantPrecision(ov::element::f16)},
+ {std::vector<float>(1024 * 1024, 1.f), ov::element::i8, ov::Shape{1024, 1024}},
+ {},
+ {ov::element::f32, {}, {0.1f}},
+ },
+ {ov::element::u8,
+ {},
+ {std::vector<float>(1024 * 1024, 1.f), ov::element::i8, ov::Shape{1024, 1024}},
+ ov::element::u8,
+ {{}, {}, {0.02f * 0.1f}},
+ {},
+ {}}},
+
// supported 3D: U8 & I8 with Dq on weights
{LayerTransformation::createParamsU8I8(),
{