Skip to content

Commit 5c50089

Browse files
[OpenVINO backend] fix ops.sum (#21463)
1 parent fbb42aa commit 5c50089

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

keras/src/backend/openvino/numpy.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,6 +1654,10 @@ def var(x, axis=None, keepdims=False):
16541654

16551655
def sum(x, axis=None, keepdims=False):
16561656
x = get_ov_output(x)
1657+
if axis is None:
1658+
flatten_shape = ov_opset.constant([-1], Type.i32).output(0)
1659+
x = ov_opset.reshape(x, flatten_shape, False).output(0)
1660+
axis = 0
16571661
axis = ov_opset.constant(axis, Type.i32).output(0)
16581662
return OpenVINOKerasTensor(ov_opset.reduce_sum(x, axis, keepdims).output(0))
16591663

0 commit comments

Comments
 (0)