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

修改COPY-FROM No. 18 static #5964

Merged
merged 11 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
45 changes: 5 additions & 40 deletions docs/api/paddle/static/InputSpec_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,7 @@ InputSpec
代码示例
::::::::::::

.. code-block:: python

from paddle.static import InputSpec

input = InputSpec([None, 784], 'float32', 'x')
label = InputSpec([None, 1], 'int64', 'label')
print(input) # InputSpec(shape=(-1, 784), dtype=paddle.float32, name=x)
print(label) # InputSpec(shape=(-1, 1), dtype=paddle.int64, name=label)

COPY-FROM: paddle.static.InputSpec

方法
::::::::::::
Expand All @@ -53,15 +45,7 @@ from_tensor(tensor, name=None)

**代码示例**

.. code-block:: python

import numpy as np
import paddle
from paddle.static import InputSpec

x = paddle.to_tensor(np.ones([2, 2], np.float32))
x_spec = InputSpec.from_tensor(x, name='x')
print(x_spec) # InputSpec(shape=(2, 2), dtype=paddle.float32, name=x)
COPY-FROM: paddle.static.InputSpec.from_tensor


from_numpy(ndarray, name=None)
Expand All @@ -81,14 +65,7 @@ from_numpy(ndarray, name=None)

**代码示例**

.. code-block:: python

import numpy as np
from paddle.static import InputSpec

x = np.ones([2, 2], np.float32)
x_spec = InputSpec.from_numpy(x, name='x')
print(x_spec) # InputSpec(shape=(2, 2), dtype=paddle.float32, name=x)
COPY-FROM: paddle.static.InputSpec.from_numpy


batch(batch_size)
Expand All @@ -106,13 +83,7 @@ batch(batch_size)

**代码示例**

.. code-block:: python

from paddle.static import InputSpec

x_spec = InputSpec(shape=[64], dtype='float32', name='x')
x_spec.batch(4)
print(x_spec) # InputSpec(shape=(4, 64), dtype=paddle.float32, name=x)
COPY-FROM: paddle.static.InputSpec.batch


unbatch()
Expand All @@ -127,10 +98,4 @@ unbatch()

**代码示例**

.. code-block:: python

from paddle.static import InputSpec

x_spec = InputSpec(shape=[4, 64], dtype='float32', name='x')
x_spec.unbatch()
print(x_spec) # InputSpec(shape=(64,), dtype=paddle.float32, name=x)
COPY-FROM: paddle.static.InputSpec.unbatch
Loading