def binary_op(op_str, a, b): if op_str == "+": return a + b elif op_str == "Add": return ov.add(a, b) elif op_str == "-": return a - b elif op_str == "Sub": return ov.subtract(a, b) elif op_str == "*": return a * b elif op_str == "Mul": return ov.multiply(a, b) elif op_str == "/": return a / b elif op_str == "Div": return ov.divide(a, b) elif op_str == "Equal": return ov.equal(a, b) elif op_str == "Greater": return ov.greater(a, b) elif op_str == "GreaterEq": return ov.greater_equal(a, b) elif op_str == "Less": return ov.less(a, b) elif op_str == "LessEq": return ov.less_equal(a, b) elif op_str == "Maximum": return ov.maximum(a, b) elif op_str == "Minimum": return ov.minimum(a, b) elif op_str == "NotEqual": return ov.not_equal(a, b) elif op_str == "Power": return ov.power(a, b)
from openvino import opset1 from openvino import opset2 from openvino import opset3 from openvino import opset4 from openvino import opset5 from openvino import opset6 from openvino import opset7 from openvino import opset8 # Helper functions for openvino module from openvino.ie_api import tensor_from_file from openvino.ie_api import compile_model # Extend Node class to support binary operators Node.__add__ = opset8.add Node.__sub__ = opset8.subtract Node.__mul__ = opset8.multiply Node.__div__ = opset8.divide Node.__truediv__ = opset8.divide Node.__radd__ = lambda left, right: opset8.add(right, left) Node.__rsub__ = lambda left, right: opset8.subtract(right, left) Node.__rmul__ = lambda left, right: opset8.multiply(right, left) Node.__rdiv__ = lambda left, right: opset8.divide(right, left) Node.__rtruediv__ = lambda left, right: opset8.divide(right, left) Node.__eq__ = opset8.equal Node.__ne__ = opset8.not_equal Node.__lt__ = opset8.less Node.__le__ = opset8.less_equal Node.__gt__ = opset8.greater Node.__ge__ = opset8.greater_equal