Skip to content

Commit d55a767

Browse files
[OpenVINO backend] supporting mul with bools (#21411)
1 parent aab446a commit d55a767

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

keras/src/backend/openvino/core.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ def __mul__(self, other):
188188
first, other = align_operand_types(
189189
first, other, "OpenVINOKerasTensor::__mul__"
190190
)
191+
if first.get_element_type() == Type.boolean:
192+
return OpenVINOKerasTensor(
193+
ov_opset.logical_and(first, other).output(0)
194+
)
191195
return OpenVINOKerasTensor(ov_opset.multiply(first, other).output(0))
192196

193197
def __rmul__(self, other):
@@ -196,6 +200,10 @@ def __rmul__(self, other):
196200
first, other = align_operand_types(
197201
first, other, "OpenVINOKerasTensor::__rmul__"
198202
)
203+
if first.get_element_type() == Type.boolean:
204+
return OpenVINOKerasTensor(
205+
ov_opset.logical_and(first, other).output(0)
206+
)
199207
return OpenVINOKerasTensor(ov_opset.multiply(first, other).output(0))
200208

201209
def __truediv__(self, other):

0 commit comments

Comments
 (0)