File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed
src/plugins/intel_cpu/src/nodes/common Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -569,25 +569,21 @@ struct ConvertPrecision<std::tuple<src_t, dst_t>> {
569569
570570 if (std::is_integral_v<src_t > || ctx.interimPrc .is_real () || std::is_integral_v<dst_t >) {
571571 parallel_for (ctx.size , [&, lbound = lbound, ubound = ubound](size_t i) {
572- const src_t value = src[i];
573- const src_t clipped = value < lbound ? lbound : (value > ubound ? ubound : value);
574572 using cast_input_t = std::conditional_t <ov::intel_cpu::any_of_v<dst_t ,
575573 ov::float16,
576574 ov::intel_cpu::bfloat16_t >,
577575 float ,
578576 src_t >;
579- dst[i] = static_cast <dst_t >(static_cast <cast_input_t >(clipped ));
577+ dst[i] = static_cast <dst_t >(static_cast <cast_input_t >(std::max ( std::min (src[i], ubound), lbound) ));
580578 });
581579 } else {
582580 parallel_for (ctx.size , [&, lbound = lbound, ubound = ubound](size_t i) {
583- const src_t value = src[i];
584- const src_t clipped = value < lbound ? lbound : (value > ubound ? ubound : value);
585581 using trunc_result_t = std::conditional_t <ov::intel_cpu::any_of_v<dst_t ,
586582 ov::float16,
587583 ov::intel_cpu::bfloat16_t >,
588584 float ,
589585 double >;
590- dst[i] = static_cast <dst_t >(static_cast <trunc_result_t >(std::trunc (static_cast <double >(clipped ))));
586+ dst[i] = static_cast <dst_t >(static_cast <trunc_result_t >(std::trunc (static_cast <double >(std::max ( std::min (src[i], ubound), lbound) ))));
591587 });
592588 }
593589
You can’t perform that action at this time.
0 commit comments