Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CodeStyle][CINN] fix Flake8 lint errors (pycodestyle rules) #55074

Merged
merged 2 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,3 @@ ignore =
per-file-ignores =
# These files need tabs for testing.
test/dygraph_to_static/test_error.py:E101,W191
# Temporarily ignore CINN files, it will fix later
python/cinn/**:
E265,
test/cinn/**:
E126,
E231,
E251,
E265,
E266,
E401,
E711,
W291,
W504,
paddle/cinn/**:
E265,
tools/cinn/**:
E265,
E401,
2 changes: 1 addition & 1 deletion test/cinn/op_mappers/test_argsort_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def set_op_outputs(self):
return {'Out': ['int64'], 'Indices': ['int64']}

def skip_check_outputs(self):
#'Out' is never used in Paddle API
# 'Out' is never used in Paddle API
return {"Out"}

def test_check_results(self):
Expand Down
4 changes: 2 additions & 2 deletions test/cinn/ops/test_fill_constant_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def prepare_inputs(self):
self.value = eval(f"{dtype}(0)")

def build_paddle_program(self, target):
if self.dtype == None:
if self.dtype is None:
x = np.full(self.shape, self.value)
x = paddle.to_tensor(x)
else:
Expand All @@ -56,7 +56,7 @@ def build_paddle_program(self, target):

def build_cinn_program(self, target):
builder = NetBuilder("fill_constant")
if self.dtype == None:
if self.dtype is None:
x = builder.fill_constant(self.shape, self.value, "out")
else:
x = builder.fill_constant(self.shape, self.value, "out", self.dtype)
Expand Down
8 changes: 4 additions & 4 deletions test/cinn/ops/test_zero_dim_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def cinn_dtype_convert(dtype_str):


##################################
#### TestElementwiseAddGrad ####
# TestElementwiseAddGrad #
##################################
# 1) x is 0D, y is 0D
@OpTestTool.skip_if(
Expand Down Expand Up @@ -109,7 +109,7 @@ def init_input(self):


##################################
#### TestElementwiseBinaryOp ####
# TestElementwiseBinaryOp #
##################################
@OpTestTool.skip_if(
not is_compiled_with_cuda(), "x86 test will be skipped due to timeout."
Expand Down Expand Up @@ -469,7 +469,7 @@ def cinn_func(self, builder, *args):


######################
#### TestUnaryOp ####
# TestUnaryOp #
######################
@OpTestTool.skip_if(
not is_compiled_with_cuda(), "x86 test will be skipped due to timeout."
Expand Down Expand Up @@ -585,7 +585,7 @@ def cinn_func(self, builder, x):


#######################
#### TestSundryOp ####
# TestSundryOp #
#######################
@OpTestTool.skip_if(
not is_compiled_with_cuda(), "x86 test will be skipped due to timeout."
Expand Down
4 changes: 2 additions & 2 deletions test/cinn/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def to_test_op(
)
for in_data in temp_inputs:
args.append(runtime.cinn_pod_value_t(in_data))
if output_shapes == None:
if output_shapes is None:
correct_result, output_shapes = self.create_target_data(
inputs_data, attrs
)
Expand Down Expand Up @@ -142,7 +142,7 @@ def to_test_op(
fn(args)

out_result = out[len(out) - 1].numpy()
if out_index != None:
if out_index is not None:
out_result = out[out_index].numpy()
np.testing.assert_allclose(out_result, correct_result, atol=1e-4)

Expand Down