diff --git a/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cpp b/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cpp index 894952c9e62..fa7afcc4bcf 100644 --- a/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cpp +++ b/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cpp @@ -382,8 +382,7 @@ struct ConvertPrecision> { src_t lbound, ubound; std::tie(lbound, ubound) = ctx.range(); - if (std::is_integral::value - || ctx.interimPrc.is_real()) { + if (std::is_integral::value) { parallel_for(iterations, [&](size_t i) { batch_type tmp; const size_t offset = i * batch; @@ -392,6 +391,19 @@ struct ConvertPrecision> { tmp[j] = static_cast(std::max(std::min(src[offset + j], ubound), lbound)); jit_convert(tmp, dst + offset, current_batch_size); // fp32 -> fp16 }); + } else if (ctx.interimPrc.is_real()) { + parallel_for(iterations, [&](size_t i) { + const size_t offset = i * batch; + const size_t current_batch_size = std::min(ctx.size - offset, batch); + if (std::is_same::type, float>::value) { // fp32 -> fp16 + jit_convert(reinterpret_cast(src) + offset, dst + offset, current_batch_size); + } else { + batch_type tmp; + for (size_t j = 0; j < current_batch_size; ++j) // src_t -> fp32 + tmp[j] = static_cast(src[offset + j]); + jit_convert(tmp, dst + offset, current_batch_size); // fp32 -> fp16 + } + }); } else { parallel_for(iterations, [&](size_t i) { batch_type tmp; @@ -420,8 +432,7 @@ struct ConvertPrecision> { float lbound, ubound; std::tie(lbound, ubound) = ctx.range(); - if (ctx.interimPrc.is_real() - || std::is_integral::value) { + if (std::is_integral::value) { parallel_for(iterations, [&](size_t i) { batch_type tmp; const size_t offset = i * batch; @@ -430,6 +441,19 @@ struct ConvertPrecision> { for (size_t j = 0; j < current_batch_size; ++j) // fp32 -> dst_t dst[offset + j] = static_cast(std::max(std::min(tmp[j], ubound), lbound)); }); + } else if (ctx.interimPrc.is_real()) { + parallel_for(iterations, [&](size_t i) { + const size_t offset = i * batch; + const size_t current_batch_size = std::min(ctx.size - offset, batch); + if (std::is_same::type, float>::value) { // fp16 -> fp32 + jit_convert(src + offset, reinterpret_cast(dst) + offset, current_batch_size); + } else { + batch_type tmp; + jit_convert(src + offset, tmp, current_batch_size); // fp16 -> fp32 + for (size_t j = 0; j < current_batch_size; ++j) // fp32 -> dst_t + dst[offset + j] = static_cast(tmp[j]); + } + }); } else { parallel_for(iterations, [&](size_t i) { batch_type tmp; diff --git a/tests/layer_tests/tensorflow_tests/test_tf_Equal.py b/tests/layer_tests/tensorflow_tests/test_tf_Equal.py index fa39468302c..7d61317857d 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_Equal.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_Equal.py @@ -157,7 +157,7 @@ class TestTFEqual(CommonTFLayerTest): pytest.param( dict(x_shape=[9], y_shape=[9], # Comparing shapes which contains corner cases x_value=x_corner, y_value=y_corner), - marks=pytest.mark.xfail(reason="94234")), + marks=pytest.mark.special_xfail(args={"ie_device": "GPU"}, reason="94234")), dict(x_shape=[1, 2, 3, 4], y_shape=[1, 2, 3, 4]) # Comparing shapes with different dimensions (more than 3, for case with nchw/nhcw), random values (false and possible true) ] @@ -179,7 +179,7 @@ class TestTFEqual(CommonTFLayerTest): pytest.param( dict(x_shape=[9], y_shape=[9], # Comparing shapes which contains corner cases x_value=x_corner, y_value=y_corner), - marks=pytest.mark.xfail(reason="94234")), + marks=pytest.mark.special_xfail(args={"ie_device": "GPU"}, reason="94234")), dict(x_shape=[1, 2, 3, 4], y_shape=[1, 2, 3, 4]) # Comparing shapes with different dimensions (more than 3, for case with nchw/nhcw), random values (false and possible true) ] @@ -201,7 +201,7 @@ class TestTFEqual(CommonTFLayerTest): pytest.param( dict(x_shape=[9], y_shape=[9], # Comparing shapes which contains corner cases x_value=x_corner, y_value=y_corner), - marks=pytest.mark.xfail(reason="94234")), + marks=pytest.mark.special_xfail(args={"ie_device": "GPU"}, reason="94234")), dict(x_shape=[1, 2, 3, 4], y_shape=[1, 2, 3, 4]) # Comparing shapes with different dimensions (more than 3, for case with nchw/nhcw), random values (false and possible true) ]