Fix issue with Pow when both inputs are scalars (#17305)
* Fix issue with Pow when both inputs are scalars * Fix code style
This commit is contained in:
1 parent
35cae6251c
commit
89d3eaa67f
3 files changed
+42
-33
No files matched your search
@@ -347,33 +347,24 @@ void align_eltwise_input_types(const NodeContext& context, Output<Node>& lhs, Ou
|
||||
// consider dynamic rank as non scalar
|
||||
const auto is_lhs_scalar = lhs_rank.is_static() && lhs_rank.get_length() == 0;
|
||||
const auto is_rhs_scalar = rhs_rank.is_static() && rhs_rank.get_length() == 0;
|
||||
if (is_lhs_scalar && is_rhs_scalar) {
|
||||
// if both scalar, align to lhs
|
||||
rhs = context.mark_node(std::make_shared<opset10::ConvertLike>(rhs, lhs));
|
||||
return;
|
||||
}
|
||||
auto lhs_dst_type = lhs_type;
|
||||
auto rhs_dst_type = rhs_type;
|
||||
if (is_lhs_scalar) {
|
||||
if (lhs_type.is_real() && !rhs_type.is_real()) {
|
||||
// if div we need to also align float types to highest bitness regardless of scalar
|
||||
if (!align_scalars)
|
||||
lhs_dst_type = element::f32;
|
||||
rhs_dst_type = element::f32;
|
||||
} else {
|
||||
lhs = context.mark_node(std::make_shared<opset10::ConvertLike>(lhs, rhs));
|
||||
return;
|
||||
}
|
||||
} else if (is_rhs_scalar) {
|
||||
if (!lhs_type.is_real() && rhs_type.is_real()) {
|
||||
if (is_lhs_scalar && lhs_type.is_real() && !rhs_type.is_real()) {
|
||||
// if div we need to also align float types to highest bitness regardless of scalar
|
||||
if (!align_scalars)
|
||||
lhs_dst_type = element::f32;
|
||||
// if div we need to also align float types to highest bitness regardless of scalar
|
||||
if (!align_scalars)
|
||||
rhs_dst_type = element::f32;
|
||||
} else {
|
||||
rhs = context.mark_node(std::make_shared<opset10::ConvertLike>(rhs, lhs));
|
||||
return;
|
||||
}
|
||||
rhs_dst_type = element::f32;
|
||||
} else if (is_rhs_scalar && !lhs_type.is_real() && rhs_type.is_real()) {
|
||||
lhs_dst_type = element::f32;
|
||||
// if div we need to also align float types to highest bitness regardless of scalar
|
||||
if (!align_scalars)
|
||||
rhs_dst_type = element::f32;
|
||||
} else if (is_lhs_scalar) {
|
||||
lhs = context.mark_node(std::make_shared<opset10::ConvertLike>(lhs, rhs));
|
||||
return;
|
||||
} else if (is_rhs_scalar) {
|
||||
rhs = context.mark_node(std::make_shared<opset10::ConvertLike>(rhs, lhs));
|
||||
return;
|
||||
}
|
||||
|
||||
if (lhs_dst_type == element::boolean || rhs_dst_type == element::boolean) {
|
||||
|
||||
Reference in new issue
Block a user