Skip to content

Commit 5aa6482

Browse files
author
Yibing Liu
committed
Rename the input of squeeze's wrapper
1 parent b586cc2 commit 5aa6482

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

python/paddle/fluid/layers/nn.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4486,7 +4486,7 @@ def reshape(x, shape, actual_shape=None, act=None, inplace=True, name=None):
44864486
return helper.append_activation(out)
44874487

44884488

4489-
def squeeze(x, axes, inplace=False, name=None):
4489+
def squeeze(input, axes, inplace=False, name=None):
44904490
"""
44914491
Remove single-dimensional entries from the shape of a tensor. Takes a
44924492
parameter axes with a list of axes to squeeze. If axes is not provided, all
@@ -4510,7 +4510,7 @@ def squeeze(x, axes, inplace=False, name=None):
45104510
Out.shape = (3, 5)
45114511
45124512
Args:
4513-
x (Variable): The input variable to be squeezed.
4513+
input (Variable): The input variable to be squeezed.
45144514
axes (list): List of integers, indicating the dimensions to be squeezed.
45154515
name (str|None): Name for this layer.
45164516
@@ -4521,20 +4521,20 @@ def squeeze(x, axes, inplace=False, name=None):
45214521
.. code-block:: python
45224522
45234523
x = layers.data(name='x', shape=[5, 1, 10])
4524-
y = layers.sequeeze(x, axes=[1])
4524+
y = layers.sequeeze(input=x, axes=[1])
45254525
"""
45264526
helper = LayerHelper("squeeze", **locals())
4527-
out = helper.create_tmp_variable(dtype=x.dtype)
4527+
out = helper.create_tmp_variable(dtype=input.dtype)
45284528
helper.append_op(
45294529
type="squeeze",
4530-
inputs={"X": x},
4530+
inputs={"X": input},
45314531
attrs={"axes": axes},
45324532
outputs={"Out": out})
45334533

45344534
return out
45354535

45364536

4537-
def unsqueeze(x, axes, inplace=False, name=None):
4537+
def unsqueeze(input, axes, inplace=False, name=None):
45384538
"""
45394539
Insert single-dimensional entries to the shape of a tensor. Takes one
45404540
required argument axes, a list of dimensions that will be inserted.
@@ -4545,7 +4545,7 @@ def unsqueeze(x, axes, inplace=False, name=None):
45454545
then Unsqueezed tensor with axes=[0, 4] has shape [1, 3, 4, 5, 1].
45464546
45474547
Args:
4548-
x (Variable): The input variable to be unsqueezed.
4548+
input (Variable): The input variable to be unsqueezed.
45494549
axes (list): List of integers, indicating the dimensions to be inserted.
45504550
name (str|None): Name for this layer.
45514551
@@ -4556,13 +4556,13 @@ def unsqueeze(x, axes, inplace=False, name=None):
45564556
.. code-block:: python
45574557
45584558
x = layers.data(name='x', shape=[5, 10])
4559-
y = layers.unsequeeze(x, axes=[1])
4559+
y = layers.unsequeeze(input=x, axes=[1])
45604560
"""
45614561
helper = LayerHelper("unsqueeze", **locals())
4562-
out = helper.create_tmp_variable(dtype=x.dtype)
4562+
out = helper.create_tmp_variable(dtype=input.dtype)
45634563
helper.append_op(
45644564
type="unsqueeze",
4565-
inputs={"X": x},
4565+
inputs={"X": input},
45664566
attrs={"axes": axes},
45674567
outputs={"Out": out})
45684568

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,15 @@ def test_sequence_unsqueeze(self):
244244
program = Program()
245245
with program_guard(program):
246246
x = layers.data(name='x', shape=[8, 2], dtype='float32')
247-
out = layers.unsqueeze(x=x, axes=[1])
247+
out = layers.unsqueeze(input=x, axes=[1])
248248
self.assertIsNotNone(out)
249249
print(str(program))
250250

251251
def test_squeeze(self):
252252
program = Program()
253253
with program_guard(program):
254254
x = layers.data(name='x', shape=[1, 1, 4], dtype='float32')
255-
out = layers.squeeze(x=x, axes=[2])
255+
out = layers.squeeze(input=x, axes=[2])
256256
self.assertIsNotNone(out)
257257
print(str(program))
258258

0 commit comments

Comments
 (0)