未验证 提交 3957007c 编写于 作者: G gouzil 提交者: GitHub

[CodeStyle][B015] replace pointless comparisons with appropriate statements (#52126)

* [CodeStyle][B015] delete unused

* [CodeStyle][B015] add assert
上级 888b8b6b
...@@ -100,7 +100,7 @@ select = [ ...@@ -100,7 +100,7 @@ select = [
"B012", "B012",
"B013", "B013",
"B014", "B014",
# "B015", "B015",
"B016", "B016",
# "B017", # "B017",
"B018", "B018",
......
...@@ -65,8 +65,7 @@ class TestDistAssign(unittest.TestCase): ...@@ -65,8 +65,7 @@ class TestDistAssign(unittest.TestCase):
for op in ops: for op in ops:
if op.type == "assign": if op.type == "assign":
dist_op = dist_context.get_dist_op_for_program(op) dist_op = dist_context.get_dist_op_for_program(op)
dist_op.dist_attr.impl_type == "assign" assert dist_op.dist_attr.impl_type == "assign"
dist_op.dist_attr.impl_idx == 0
x_name = op.input_arg_names[0] x_name = op.input_arg_names[0]
out_name = op.output_arg_names[0] out_name = op.output_arg_names[0]
......
...@@ -60,8 +60,8 @@ class TestDistScale(unittest.TestCase): ...@@ -60,8 +60,8 @@ class TestDistScale(unittest.TestCase):
ops = dist_main_prog.global_block().ops ops = dist_main_prog.global_block().ops
scale_op = ops[0] scale_op = ops[0]
dist_op = dist_context.get_dist_op_for_program(scale_op) dist_op = dist_context.get_dist_op_for_program(scale_op)
dist_op.dist_attr.impl_type == "scale" assert dist_op.dist_attr.impl_type == "scale"
dist_op.dist_attr.impl_idx == 0 assert dist_op.dist_attr.impl_idx == 0
in_name = scale_op.input_arg_names[0] in_name = scale_op.input_arg_names[0]
out_name = scale_op.output_arg_names[0] out_name = scale_op.output_arg_names[0]
......
...@@ -60,8 +60,8 @@ class TestDistShape(unittest.TestCase): ...@@ -60,8 +60,8 @@ class TestDistShape(unittest.TestCase):
ops = dist_main_prog.global_block().ops ops = dist_main_prog.global_block().ops
shape_op = ops[0] shape_op = ops[0]
dist_op = dist_context.get_dist_op_for_program(shape_op) dist_op = dist_context.get_dist_op_for_program(shape_op)
dist_op.dist_attr.impl_type == "shape" assert dist_op.dist_attr.impl_type == "shape"
dist_op.dist_attr.impl_idx == 0 assert dist_op.dist_attr.impl_idx == 0
in_name = shape_op.input_arg_names[0] in_name = shape_op.input_arg_names[0]
out_name = shape_op.output_arg_names[0] out_name = shape_op.output_arg_names[0]
......
...@@ -113,7 +113,7 @@ class TestCase5(TestClipOp): ...@@ -113,7 +113,7 @@ class TestCase5(TestClipOp):
class TestCase6(TestClipOp): class TestCase6(TestClipOp):
def initTestCase(self): def initTestCase(self):
self.dtype == np.float16 self.dtype = np.float16
self.shape = (4, 8, 8) self.shape = (4, 8, 8)
self.max = 0.7 self.max = 0.7
self.min = 0.2 self.min = 0.2
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册