未验证 提交 9bcfc1a8 编写于 作者: A Aurelius84 提交者: GitHub

Fix paddle.nn.data in new unittest (#26484)

* Rename `Input` into `InputSpec`

* remove alias
上级 ac2010f4
...@@ -24,11 +24,6 @@ __all__ = ['data'] ...@@ -24,11 +24,6 @@ __all__ = ['data']
def data(name, shape, dtype='float32', lod_level=0): def data(name, shape, dtype='float32', lod_level=0):
""" """
:api_attr: Static Graph
:alias_main: paddle.nn.data
:alias: paddle.nn.data,paddle.nn.input.data
:old_api: paddle.fluid.data
**Data Layer** **Data Layer**
This function creates a variable on the global block. The global variable This function creates a variable on the global block. The global variable
...@@ -52,7 +47,7 @@ def data(name, shape, dtype='float32', lod_level=0): ...@@ -52,7 +47,7 @@ def data(name, shape, dtype='float32', lod_level=0):
The default :code:`stop_gradient` attribute of the Variable created by The default :code:`stop_gradient` attribute of the Variable created by
this API is true, which means the gradient won't be passed backward this API is true, which means the gradient won't be passed backward
through the data Varaible. Set :code:`var.stop_gradient = False` If through the data Variable. Set :code:`var.stop_gradient = False` If
user would like to pass backward gradient. user would like to pass backward gradient.
Args: Args:
...@@ -88,7 +83,7 @@ def data(name, shape, dtype='float32', lod_level=0): ...@@ -88,7 +83,7 @@ def data(name, shape, dtype='float32', lod_level=0):
z = x + y z = x + y
# In this example, we will feed x and y with np-ndarry "1" # In this example, we will feed x and y with np-ndarray "1"
# and fetch z, like implementing "1 + 1 = 2" in PaddlePaddle # and fetch z, like implementing "1 + 1 = 2" in PaddlePaddle
feed_data = np.ones(shape=[3, 2, 1], dtype=np.float32) feed_data = np.ones(shape=[3, 2, 1], dtype=np.float32)
......
...@@ -61,7 +61,7 @@ class TestErfLayer(unittest.TestCase): ...@@ -61,7 +61,7 @@ class TestErfLayer(unittest.TestCase):
def test_name(self): def test_name(self):
with fluid.program_guard(fluid.Program()): with fluid.program_guard(fluid.Program()):
x = paddle.nn.data('x', [3, 4]) x = paddle.static.data('x', [3, 4])
y = paddle.erf(x, name='erf') y = paddle.erf(x, name='erf')
self.assertTrue('erf' in y.name) self.assertTrue('erf' in y.name)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册