def binary_op(op_str, a, b): if op_str == "+": return a + b elif op_str == "Add": return ng.add(a, b) elif op_str == "-": return a - b elif op_str == "Sub": return ng.subtract(a, b) elif op_str == "*": return a * b elif op_str == "Mul": return ng.multiply(a, b) elif op_str == "/": return a / b elif op_str == "Div": return ng.divide(a, b) elif op_str == "Equal": return ng.equal(a, b) elif op_str == "Greater": return ng.greater(a, b) elif op_str == "GreaterEq": return ng.greater_equal(a, b) elif op_str == "Less": return ng.less(a, b) elif op_str == "LessEq": return ng.less_equal(a, b) elif op_str == "Maximum": return ng.maximum(a, b) elif op_str == "Minimum": return ng.minimum(a, b) elif op_str == "NotEqual": return ng.not_equal(a, b) elif op_str == "Power": return ng.power(a, b)
def Equal(onnx_node, ng_inputs): # type: (NodeWrapper, List[NgraphNode]) -> NgraphNode """Perform the `equal` logical operation elementwise on two input tensors.""" left, right = broadcast_for_binary_operation(onnx_node, ng_inputs) return ng.equal(left, right)
def Not(onnx_node, ng_inputs): # type: (NodeWrapper, List[TensorOp]) -> Op return ng.equal(ng_inputs[0] + 1, 1)
def Equal(onnx_node, ng_inputs): # type: (NodeWrapper, List[TensorOp]) -> Op left, right = cast_axes_for_binary_broadcast(onnx_node, ng_inputs) return ng.equal(left, right)