Skip to content

Commit

Permalink
【Fix en docs】 Fix document formatting*test=document_fix (#43996)
Browse files Browse the repository at this point in the history
* Update creation.py

修复Returns格式问题

* 【Fix en docs】 Fix document formatting

修复Returns和Return Type格式问题。

* 修复格式,解决中英文文档不一致问题

为了解决中英文不一致的问题,统一将Returns内容第一个标点符号改成逗号。删掉Return Type

* fix大量 与 Return Type 和 Return相关的文档

* Convert Variable and LoDTensor to Tensor

* Update python/paddle/nn/functional/common.py

Co-authored-by: Nyakku Shigure <sigure.qaq@gmail.com>

* Update detection.py

* Update io.py

* Update io.py

* Update loss.py

* Update loss.py

* Update io.py

* Update io.py

* Update nn.py

* Update nn.py

* Update nn.py

* Update nn.py

* Update nn.py

* Update nn.py

* Update nn.py

* Update nn.py

* Update nn.py

* Update nn.py

* Update sequence_lod.py

* Update sequence_lod.py

* Update sequence_lod.py

* Update sequence_lod.py

* Update sequence_lod.py

* Update sequence_lod.py

* Update sequence_lod.py

* Update sequence_lod.py

* Update sequence_lod.py

* Update sequence_lod.py

* Update sequence_lod.py

* Update metrics.py

* Update metrics.py

* Update metrics.py

* Update metrics.py

* Update metrics.py

* Update nets.py

* Update reader.py

* Update nn.py

* Update io.py

* Update nn.py

* Update io.py

* remove Return Type to Returns

* Update sequence_lod.py

* Update sequence_lod.py

* Update common.py

* Update common.py

* Update extension.py

* Update creation.py

* update*test=document_fix

* Update io.py

* Update manipulation.py

* Update sequence_lod.py

* Update common.py

* Update common.py

* Update common.py

* Update common.py

* update*test=document_fix

* update*test=document_fix

* Update loss.py

* Update loss.py

* update*test=document_fix

* paddle.crop

* for ci;test=document_fix

* update io;test=document_fix

* Update io.py

* update sequence_expand docs;test=document_fix

* update note typos;test=document_fix

Co-authored-by: Nyakku Shigure <sigure.qaq@gmail.com>
Co-authored-by: Ligoml <39876205+Ligoml@users.noreply.github.com>
  • Loading branch information
3 people committed Aug 8, 2022
1 parent 8573ca5 commit 8537eda
Show file tree
Hide file tree
Showing 13 changed files with 105 additions and 168 deletions.
44 changes: 5 additions & 39 deletions python/paddle/fluid/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ def is_belong_to_optimizer(var):
@dygraph_not_support
def get_program_parameter(program):
"""
:api_attr: Static Graph
Get all the parameters from Program.
Args:
Expand All @@ -212,8 +210,6 @@ def get_program_parameter(program):
@dygraph_not_support
def get_program_persistable_vars(program):
"""
:api_attr: Static Graph
Get all the persistable vars from Program.
Args:
Expand Down Expand Up @@ -292,9 +288,7 @@ def save_vars(executor,
predicate=None,
filename=None):
"""
:api_attr: Static Graph
This API saves specific variables in the `Program` to files.
Save specific variables in the `Program` to files.
There are two ways to specify the variables to be saved: set variables in
a list and assign it to the `vars`, or use the `predicate` function to select
Expand Down Expand Up @@ -436,9 +430,7 @@ def name_has_fc(var):
@dygraph_not_support
def save_params(executor, dirname, main_program=None, filename=None):
"""
:api_attr: Static Graph
This operator saves all parameters from the :code:`main_program` to
Save all parameters from the :code:`main_program` to
the folder :code:`dirname` or file :code:`filename`. You can refer to
:ref:`api_guide_model_save_reader_en` for more details.
Expand Down Expand Up @@ -670,9 +662,7 @@ def is_valid(var):
@dygraph_not_support
def save_persistables(executor, dirname, main_program=None, filename=None):
"""
:api_attr: Static Graph
This operator saves all persistable variables from :code:`main_program` to
Save all persistable variables from :code:`main_program` to
the folder :code:`dirname` or file :code:`filename`. You can refer to
:ref:`api_guide_model_save_reader_en` for more details. And then
saves these persistables variables to the folder :code:`dirname` or file
Expand Down Expand Up @@ -780,9 +770,6 @@ def load_vars(executor,
Returns:
None
Raises:
TypeError: If `main_program` is not an instance of Program nor None.
Examples:
.. code-block:: python
Expand Down Expand Up @@ -1247,8 +1234,6 @@ def save_inference_model(dirname,
program_only=False,
clip_extra=False):
"""
:api_attr: Static Graph
Prune the given `main_program` to build a new program especially for inference,
and then save it and all related parameters to given `dirname` .
If you just want to save parameters of your trained model, please use the
Expand Down Expand Up @@ -1279,7 +1264,7 @@ def save_inference_model(dirname,
params_filename(str, optional): The name of file to save all related parameters.
If it is set None, parameters will be saved
in separate files .
export_for_deployment(bool): If True, programs are modified to only support
export_for_deployment(bool, optional): If True, programs are modified to only support
direct inference deployment. Otherwise,
more information will be stored for flexible
optimization and re-training. Currently, only
Expand All @@ -1290,14 +1275,7 @@ def save_inference_model(dirname,
Default: False.
Returns:
The fetch variables' name list
Return Type:
list
Raises:
ValueError: If `feed_var_names` is not a list of basestring, an exception is thrown.
ValueError: If `target_vars` is not a list of Variable, an exception is thrown.
list, The fetch variables' name list.
Examples:
.. code-block:: python
Expand Down Expand Up @@ -1462,8 +1440,6 @@ def load_inference_model(dirname,
params_filename=None,
pserver_endpoints=None):
"""
:api_attr: Static Graph
Load the inference model from a given directory. By this API, you can get the model
structure(Inference Program) and model parameters. If you just want to load
parameters of the pre-trained model, please use the :ref:`api_fluid_io_load_params` API.
Expand Down Expand Up @@ -1501,8 +1477,6 @@ def load_inference_model(dirname,
``Variable`` (refer to :ref:`api_guide_Program_en`). It contains variables from which
we can get inference results.
Raises:
ValueError: If `dirname` is not a existing directory.
Examples:
.. code-block:: python
Expand Down Expand Up @@ -1659,12 +1633,6 @@ def get_parameter_value_by_name(name, executor, program=None):
Returns:
numpy.array: The parameter's values.
Raises:
TypeError: If given `name` is not an instance of basestring.
TypeError: If the parameter with the given name doesn't exist.
AssertionError: If there is a variable named `name` in the
given program but it is not a Parameter.
Examples:
.. code-block:: python
Expand Down Expand Up @@ -2314,8 +2282,6 @@ def _load_vars_with_try_catch(exe,
@static_only
def set_program_state(program, state_dict):
"""
:api_attr: Static Graph
Set program parameter from state_dict
An exception will throw if shape or dtype of the parameters is not match.
Expand Down
8 changes: 3 additions & 5 deletions python/paddle/fluid/layers/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def cross_entropy2(input, label, ignore_index=kIgnoreIndex):
def square_error_cost(input, label):
r"""
This op accepts input predictions and target label and returns the
Accept input predictions and target label and returns the
squared error cost.
For predictions label, and target label, the equation is:
Expand All @@ -325,10 +325,8 @@ def square_error_cost(input, label):
label (Tensor): Label tensor, the data type should be float32.
Returns:
The tensor storing the element-wise squared error \
difference between input and label.
Return type: Tensor.
Tensor, The tensor storing the element-wise squared
error difference between input and label.
Examples:
Expand Down
23 changes: 7 additions & 16 deletions python/paddle/fluid/layers/nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -9359,14 +9359,14 @@ def crop(x, shape=None, offsets=None, name=None):

Parameters:
x (Variable): Tensor, data type can be float32 or float64.
shape (Variable|list/tuple of integers): The output shape is specified
shape (Variable|list/tuple of integers, optional): The output shape is specified
by `shape`, which can be a Tensor or a list/tuple of integers.
If it is a Tensor, it's rank must be the same as `x` , only
it's shape will be used, and the value of it will be ignored. This way
is suitable for the case that the output shape may be changed each
iteration. If it is a list/tuple of integers, it's length must be the same
as the rank of `x`
offsets (Variable|list/tuple of integers|None): Specifies the cropping
offsets (Variable|list/tuple of integers|None, optional): Specifies the cropping
offsets at each dimension. It can be a Tensor or a list/tuple
of integers. If it is a Tensor, it's rank must be the same as `x`.
This way is suitable for the case that the offsets may be changed
Expand All @@ -9377,13 +9377,7 @@ def crop(x, shape=None, offsets=None, name=None):
None by default.

Returns:
The cropped Tensor, which has the same rank and data type with `x`

Return Type:
Variable

Raises:
ValueError: If shape is not a list, tuple or Variable.
Tensor, The cropped Tensor, which has the same rank and data type with `x`.

Examples:

Expand Down Expand Up @@ -9721,7 +9715,8 @@ def pad2d(input,
name (str, optional) : The default value is None. Normally there is no need for
user to set this property. For more information, please refer to :ref:`api_guide_Name` .

Returns: Tensor, a 4-D Tensor padded according to paddings and mode and data type is same as input.
Returns:
Tensor, a 4-D Tensor padded according to paddings and mode and data type is same as input.

Examples:
.. code-block:: text
Expand Down Expand Up @@ -13282,14 +13277,10 @@ def space_to_depth(x, blocksize, name=None):
to :ref:`api_guide_Name`. Usually name is no need to set and \
None by default.

Returns: The output, which should be 4 dims Tensor or LodTensor, with the shape \
Returns:
Tensor, The output, which should be 4 dims Tensor or LodTensor, with the shape \
[batch, channel * blocksize * blocksize, height/blocksize, width/blocksize]

Return Type: Variable

Raises:
TypeError: blocksize type must be int64.

Examples:
.. code-block:: python

Expand Down
Loading

0 comments on commit 8537eda

Please sign in to comment.