Skip to content

Commit 2aac317

Browse files
committed
fix: check data of tensor convert them into float
1 parent 2ea2e82 commit 2aac317

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

keras/src/backend/openvino/numpy.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,9 +1024,20 @@ def logaddexp(x1, x2):
10241024
x1 = get_ov_output(x1)
10251025
x2 = get_ov_output(x2)
10261026

1027+
x1_type = x1.get_element_type()
1028+
x2_type = x2.get_element_type()
1029+
1030+
if x1_type.is_integral() or x2_type.is_integral():
1031+
float_dtype = OPENVINO_DTYPES[config.floatx()]
1032+
if x1_type.is_integral():
1033+
x1 = ov_opset.convert(x1, float_dtype)
1034+
if x2_type.is_integral():
1035+
x2 = ov_opset.convert(x2, float_dtype)
1036+
10271037
x1, x2 = _align_operand_types(x1, x2, "logaddexp()")
10281038

10291039
max_val = ov_opset.maximum(x1, x2).output(0)
1040+
10301041
abs_diff = ov_opset.abs(ov_opset.subtract(x1, x2).output(0)).output(0)
10311042
neg_abs_diff = ov_opset.negative(abs_diff).output(0)
10321043
exp_neg_abs = ov_opset.exp(neg_abs_diff).output(0)

0 commit comments

Comments
 (0)