Skip to content

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

[GPU] not to apply EliminateScalarMul for scalar const less than 1 (#29602)

Eddy Kim7b1d059a43b2
diff --git a/src/common/transformations/src/transformations/common_optimizations/activations_scaling.cpp b/src/common/transformations/src/transformations/common_optimizations/activations_scaling.cpp
index e3023df37e4..47547247d41 100644
--- a/src/common/transformations/src/transformations/common_optimizations/activations_scaling.cpp
+++ b/src/common/transformations/src/transformations/common_optimizations/activations_scaling.cpp
@@ -195,13 +195,16 @@ ov::pass::activations_scaling::EliminateScalarMul::EliminateScalarMul() {
return false;
}
+ auto scale_const = ov::as_type_ptr<ov::op::v0::Constant>(pattern_map.at(scale_const_m).get_node_shared_ptr());
+
+ if (pattern_map.count(shape_of_m) == 0 && scale_const->cast_vector<float>()[0] < 1.f)
+ return false;
+
auto activation = pattern_map.at(activation_m);
auto norm = pattern_map.at(norm_m).get_node_shared_ptr();
norm->input(0).replace_source_output(activation);
- auto scale_const = ov::as_type_ptr<ov::op::v0::Constant>(pattern_map.at(scale_const_m).get_node_shared_ptr());
-
if (pattern_map.count(rms_m)) {
auto rms = ov::as_type_ptr<ov::op::internal::RMS>(pattern_map.at(rms_m).get_node_shared_ptr());
auto eps = rms->get_epsilon();