提交 11f41a1c 编写于 作者: W wjj19950828

add Or and Xor

上级 855cba84
......@@ -76,7 +76,7 @@
| 81 | Add | 82 | Concat | 83 | Max | 84 | Min |
| 85 | GreaterOrEqual | 86 | GatherND | 87 | And | 88 | cos |
| 89 | Neg | 90 | SpaceToDepth | 91 | GatherElement | 92 | Sin |
| 93 | CumSum | | | | | | |
| 93 | CumSum | 94 | Or | 95 | Xor | | |
## PyTorch
......
......@@ -21,6 +21,8 @@ import unittest
min_opset_version_map = {
"And": 7,
"Or": 7,
"Xor": 7,
}
......@@ -47,7 +49,7 @@ class TestLogicalopsConvert(OPConvertAutoScanTest):
input_dtype = draw(st.sampled_from(["bool"]))
config = {
"op_names": ["And"],
"op_names": ["And", "Or", "Xor"],
"test_data_shapes": [input1_shape, input2_shape],
"test_data_types": [[input_dtype], [input_dtype]],
"inputs_shape": [],
......
......@@ -33,6 +33,26 @@ class OpSet7(OpSet):
def __init__(self, decoder, paddle_graph):
super(OpSet7, self).__init__(decoder, paddle_graph)
@print_mapping_info
def Or(self, node):
val_x = self.graph.get_input_node(node, idx=0, copy=True)
val_y = self.graph.get_input_node(node, idx=1, copy=True)
self.paddle_graph.add_layer(
"paddle.logical_or",
inputs={"x": val_x.name,
"y": val_y.name},
outputs=[node.name])
@print_mapping_info
def Xor(self, node):
val_x = self.graph.get_input_node(node, idx=0, copy=True)
val_y = self.graph.get_input_node(node, idx=1, copy=True)
self.paddle_graph.add_layer(
"paddle.logical_xor",
inputs={"x": val_x.name,
"y": val_y.name},
outputs=[node.name])
@print_mapping_info
def Unsqueeze(self, node):
val_x = self.graph.get_input_node(node, idx=0, copy=True)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册