Skip to content

Commit decaeb1

Browse files
committed
fix style check after conflicts check. test=develop
1 parent 0b29078 commit decaeb1

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

python/paddle/fluid/layers/nn.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7806,18 +7806,17 @@ def grid_sampler(x, grid, name=None):
78067806
out = fluid.layers.grid_sampler(x=x, grid=grid)
78077807
"""
78087808
helper = LayerHelper("grid_sampler", **locals())
7809-
dtype = helper.input_dtype()
78107809

78117810
if not isinstance(x, Variable):
78127811
return ValueError("The x should be a Variable")
78137812

78147813
if not isinstance(grid, Variable):
78157814
return ValueError("The grid should be a Variable")
78167815

7817-
out = helper.create_variable_for_type_inference(dtype)
7816+
out = helper.create_variable_for_type_inference(x.dtype)
78187817
ipts = {'X': x, 'Grid': grid}
78197818

7820-
helper.append_op(type='grid_sampler', inputs=ipts, outputs={'Output', out})
7819+
helper.append_op(type='grid_sampler', inputs=ipts, outputs={'Output': out})
78217820
return out
78227821

78237822

python/paddle/fluid/tests/unittests/test_layers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -868,12 +868,12 @@ def iou_similarity(self):
868868
def test_grid_sampler(self):
869869
program = Program()
870870
with program_guard(program):
871-
x = layers.data(name='x', shape=[2, 3, 5, 7], dtype='float32')
872-
grid = layers.data(name='grid', shape=[2, 5, 7, 2], dtype='float32')
871+
x = layers.data(name='x', shape=[3, 5, 7], dtype='float32')
872+
grid = layers.data(name='grid', shape=[5, 7, 2], dtype='float32')
873873
out = layers.grid_sampler(x, grid)
874874
self.assertIsNotNone(out)
875875
print(str(program))
876-
876+
877877
def test_affine_grid(self):
878878
program = Program()
879879
with program_guard(program):

0 commit comments

Comments
 (0)