Skip to content

Commit 92d9735

Browse files
committed
fixed reshape()
1 parent 954021e commit 92d9735

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

keras/src/backend/openvino/numpy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3442,6 +3442,8 @@ def reshape(x, newshape):
34423442
newshape = [newshape]
34433443
elif isinstance(newshape, tuple):
34443444
newshape = list(newshape)
3445+
# Replace None (dynamic dims) with -1, which OpenVINO uses for inference
3446+
newshape = [-1 if d is None else d for d in newshape]
34453447
newshape = ov_opset.constant(newshape, Type.i32).output(0)
34463448
return OpenVINOKerasTensor(ov_opset.reshape(x, newshape, False).output(0))
34473449

0 commit comments

Comments
 (0)