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][PLR0402][C405] #52325

Closed
wants to merge 2 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

import paddle
import paddle.distributed as dist
import paddle.fluid as fluid
import paddle.fluid.data_feeder as data_feeder
import paddle.framework as framework
from paddle import fluid
from paddle.fluid import data_feeder
from paddle import framework

paddle.enable_static()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

import paddle
import paddle.distributed as dist
import paddle.fluid as fluid
import paddle.fluid.data_feeder as data_feeder
import paddle.framework as framework
from paddle import fluid
from paddle.fluid import data_feeder
from paddle import framework

paddle.enable_static()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,14 +416,14 @@ def test_check_grad_no_filter(self):
place = core.CUDAPlace(0)
if core.is_float16_supported(place) and grad_check:
self.check_grad_with_place(
place, ['Input'], 'Output', no_grad_set=set(['Filter'])
place, ['Input'], 'Output', no_grad_set={'Filter'}
)

def test_check_grad_no_input(self):
place = core.CUDAPlace(0)
if core.is_float16_supported(place) and grad_check:
self.check_grad_with_place(
place, ['Filter'], 'Output', no_grad_set=set(['Input'])
place, ['Filter'], 'Output', no_grad_set={'Input'}
)

cls_name = "{0}_{1}".format(parent.__name__, "FP16OP")
Expand Down Expand Up @@ -464,7 +464,7 @@ def test_check_grad_no_filter(self):
place,
['Input'],
'Output',
no_grad_set=set(['Filter']),
no_grad_set={'Filter'},
user_defined_grads=[numeric_grads],
)

Expand All @@ -475,7 +475,7 @@ def test_check_grad_no_input(self):
place,
['Filter'],
'Output',
no_grad_set=set(['Input']),
no_grad_set={'Input'},
user_defined_grads=[numeric_grads],
)

Expand Down Expand Up @@ -503,14 +503,14 @@ def test_check_grad_no_filter(self):
place = core.CUDAPlace(0)
if core.is_float16_supported(place) and grad_check:
self.check_grad_with_place(
place, ['Input'], 'Output', no_grad_set=set(['Filter'])
place, ['Input'], 'Output', no_grad_set={'Filter'}
)

def test_check_grad_no_input(self):
place = core.CUDAPlace(0)
if core.is_float16_supported(place) and grad_check:
self.check_grad_with_place(
place, ['Filter'], 'Output', no_grad_set=set(['Input'])
place, ['Filter'], 'Output', no_grad_set={'Input'}
)

def init_data_format(self):
Expand Down
16 changes: 8 additions & 8 deletions python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,11 +796,11 @@ def test_check_grad_no_input(self):
['Filter'],
'Output',
max_relative_error=0.02,
no_grad_set=set(['Input']),
no_grad_set={'Input'},
)
else:
self.check_grad(
['Filter'], 'Output', no_grad_set=set(['Input'])
['Filter'], 'Output', no_grad_set={'Input'}
)

def test_check_grad_no_filter(self):
Expand All @@ -813,11 +813,11 @@ def test_check_grad_no_filter(self):
['Input'],
'Output',
max_relative_error=0.02,
no_grad_set=set(['Filter']),
no_grad_set={'Filter'},
)
else:
self.check_grad(
['Input'], 'Output', no_grad_set=set(['Filter'])
['Input'], 'Output', no_grad_set={'Filter'}
)

def test_check_grad(self):
Expand All @@ -827,13 +827,13 @@ def test_check_grad(self):
if core.is_float16_supported(place):
self.check_grad_with_place(
place,
set(['Input', 'Filter']),
{'Input', 'Filter'},
'Output',
max_relative_error=0.02,
)
else:
self.check_grad(
set(['Input', 'Filter']), 'Output', max_relative_error=0.02
{'Input', 'Filter'}, 'Output', max_relative_error=0.02
)


Expand Down Expand Up @@ -980,7 +980,7 @@ def test_check_grad_no_input(self):
['Filter'],
'Output',
max_relative_error=0.02,
no_grad_set=set(['Input']),
no_grad_set={'Input'},
user_defined_grads=[numeric_grads],
)

Expand All @@ -992,7 +992,7 @@ def test_check_grad_no_filter(self):
['Input'],
'Output',
max_relative_error=0.02,
no_grad_set=set(['Filter']),
no_grad_set={'Filter'},
user_defined_grads=[numeric_grads],
)

Expand Down
2 changes: 1 addition & 1 deletion python/paddle/fluid/tests/unittests/test_kldiv_loss_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_check_output(self):
self.check_output()

def test_check_grad(self):
self.check_grad(['X'], 'Loss', no_grad_set=set(["Target"]))
self.check_grad(['X'], 'Loss', no_grad_set={"Target"})

def initTestCase(self):
self.x_shape = (4, 5, 5)
Expand Down
4 changes: 2 additions & 2 deletions python/paddle/fluid/tests/unittests/test_kthvalue_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_check_output(self):

def test_check_grad(self):
paddle.enable_static()
self.check_grad(set(['X']), 'Out')
self.check_grad({'X'}, 'Out')


class TestKthvalueOpWithKeepdim(OpTest):
Expand All @@ -85,7 +85,7 @@ def test_check_output(self):

def test_check_grad(self):
paddle.enable_static()
self.check_grad(set(['X']), 'Out')
self.check_grad({'X'}, 'Out')


class TestKthvalueOpKernels(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions python/paddle/fluid/tests/unittests/test_mode_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_check_output(self):

def test_check_grad(self):
paddle.enable_static()
self.check_grad(set(['X']), 'Out')
self.check_grad({'X'}, 'Out')


class TestModeOpLastdim(OpTest):
Expand All @@ -103,7 +103,7 @@ def test_check_output(self):

def test_check_grad(self):
paddle.enable_static()
self.check_grad(set(['X']), 'Out')
self.check_grad({'X'}, 'Out')


class TestModeOpKernels(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions python/paddle/fluid/tests/unittests/test_smooth_l1_loss_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ def test_check_grad_ingore_x(self):
['Y'],
'Out',
max_relative_error=0.03,
no_grad_set=set(['X', 'InsideWeight', 'OutsideWeight']),
no_grad_set={'X', 'InsideWeight', 'OutsideWeight'},
)

def test_check_grad_ingore_y(self):
self.check_grad(
['X'],
'Out',
max_relative_error=0.03,
no_grad_set=set(['Y', 'InsideWeight', 'OutsideWeight']),
no_grad_set={'Y', 'InsideWeight', 'OutsideWeight'},
)


Expand Down