Skip to content

Commit f5a4432

Browse files
committed
fixed reshape()
1 parent a214086 commit f5a4432

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
@@ -3452,6 +3452,8 @@ def reshape(x, newshape):
34523452
newshape = [newshape]
34533453
elif isinstance(newshape, tuple):
34543454
newshape = list(newshape)
3455+
# Replace None (dynamic dims) with -1, which OpenVINO uses for inference
3456+
newshape = [-1 if d is None else d for d in newshape]
34553457
newshape = ov_opset.constant(newshape, Type.i32).output(0)
34563458
return OpenVINOKerasTensor(ov_opset.reshape(x, newshape, False).output(0))
34573459

0 commit comments

Comments
 (0)