提交 5aa64827 编写于 作者: Y Yibing Liu

Rename the input of squeeze's wrapper

上级 b586cc2a
...@@ -4486,7 +4486,7 @@ def reshape(x, shape, actual_shape=None, act=None, inplace=True, name=None): ...@@ -4486,7 +4486,7 @@ def reshape(x, shape, actual_shape=None, act=None, inplace=True, name=None):
return helper.append_activation(out) return helper.append_activation(out)
def squeeze(x, axes, inplace=False, name=None): def squeeze(input, axes, inplace=False, name=None):
""" """
Remove single-dimensional entries from the shape of a tensor. Takes a Remove single-dimensional entries from the shape of a tensor. Takes a
parameter axes with a list of axes to squeeze. If axes is not provided, all 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): ...@@ -4510,7 +4510,7 @@ def squeeze(x, axes, inplace=False, name=None):
Out.shape = (3, 5) Out.shape = (3, 5)
Args: Args:
x (Variable): The input variable to be squeezed. input (Variable): The input variable to be squeezed.
axes (list): List of integers, indicating the dimensions to be squeezed. axes (list): List of integers, indicating the dimensions to be squeezed.
name (str|None): Name for this layer. name (str|None): Name for this layer.
...@@ -4521,20 +4521,20 @@ def squeeze(x, axes, inplace=False, name=None): ...@@ -4521,20 +4521,20 @@ def squeeze(x, axes, inplace=False, name=None):
.. code-block:: python .. code-block:: python
x = layers.data(name='x', shape=[5, 1, 10]) x = layers.data(name='x', shape=[5, 1, 10])
y = layers.sequeeze(x, axes=[1]) y = layers.sequeeze(input=x, axes=[1])
""" """
helper = LayerHelper("squeeze", **locals()) helper = LayerHelper("squeeze", **locals())
out = helper.create_tmp_variable(dtype=x.dtype) out = helper.create_tmp_variable(dtype=input.dtype)
helper.append_op( helper.append_op(
type="squeeze", type="squeeze",
inputs={"X": x}, inputs={"X": input},
attrs={"axes": axes}, attrs={"axes": axes},
outputs={"Out": out}) outputs={"Out": out})
return out return out
def unsqueeze(x, axes, inplace=False, name=None): def unsqueeze(input, axes, inplace=False, name=None):
""" """
Insert single-dimensional entries to the shape of a tensor. Takes one Insert single-dimensional entries to the shape of a tensor. Takes one
required argument axes, a list of dimensions that will be inserted. required argument axes, a list of dimensions that will be inserted.
...@@ -4545,7 +4545,7 @@ def unsqueeze(x, axes, inplace=False, name=None): ...@@ -4545,7 +4545,7 @@ def unsqueeze(x, axes, inplace=False, name=None):
then Unsqueezed tensor with axes=[0, 4] has shape [1, 3, 4, 5, 1]. then Unsqueezed tensor with axes=[0, 4] has shape [1, 3, 4, 5, 1].
Args: Args:
x (Variable): The input variable to be unsqueezed. input (Variable): The input variable to be unsqueezed.
axes (list): List of integers, indicating the dimensions to be inserted. axes (list): List of integers, indicating the dimensions to be inserted.
name (str|None): Name for this layer. name (str|None): Name for this layer.
...@@ -4556,13 +4556,13 @@ def unsqueeze(x, axes, inplace=False, name=None): ...@@ -4556,13 +4556,13 @@ def unsqueeze(x, axes, inplace=False, name=None):
.. code-block:: python .. code-block:: python
x = layers.data(name='x', shape=[5, 10]) x = layers.data(name='x', shape=[5, 10])
y = layers.unsequeeze(x, axes=[1]) y = layers.unsequeeze(input=x, axes=[1])
""" """
helper = LayerHelper("unsqueeze", **locals()) helper = LayerHelper("unsqueeze", **locals())
out = helper.create_tmp_variable(dtype=x.dtype) out = helper.create_tmp_variable(dtype=input.dtype)
helper.append_op( helper.append_op(
type="unsqueeze", type="unsqueeze",
inputs={"X": x}, inputs={"X": input},
attrs={"axes": axes}, attrs={"axes": axes},
outputs={"Out": out}) outputs={"Out": out})
......
...@@ -244,7 +244,7 @@ class TestBook(unittest.TestCase): ...@@ -244,7 +244,7 @@ class TestBook(unittest.TestCase):
program = Program() program = Program()
with program_guard(program): with program_guard(program):
x = layers.data(name='x', shape=[8, 2], dtype='float32') x = layers.data(name='x', shape=[8, 2], dtype='float32')
out = layers.unsqueeze(x=x, axes=[1]) out = layers.unsqueeze(input=x, axes=[1])
self.assertIsNotNone(out) self.assertIsNotNone(out)
print(str(program)) print(str(program))
...@@ -252,7 +252,7 @@ class TestBook(unittest.TestCase): ...@@ -252,7 +252,7 @@ class TestBook(unittest.TestCase):
program = Program() program = Program()
with program_guard(program): with program_guard(program):
x = layers.data(name='x', shape=[1, 1, 4], dtype='float32') x = layers.data(name='x', shape=[1, 1, 4], dtype='float32')
out = layers.squeeze(x=x, axes=[2]) out = layers.squeeze(input=x, axes=[2])
self.assertIsNotNone(out) self.assertIsNotNone(out)
print(str(program)) print(str(program))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册