未验证 提交 0978bca4 编写于 作者: L liu zhengxi 提交者: GitHub

Refine dynamic_decode docs (#49151)

上级 332aadc0
...@@ -1029,26 +1029,22 @@ def dynamic_decode( ...@@ -1029,26 +1029,22 @@ def dynamic_decode(
**kwargs: Additional keyword arguments. Arguments passed to `decoder.step`. **kwargs: Additional keyword arguments. Arguments passed to `decoder.step`.
Returns: Returns:
tuple: A tuple( :code:`(final_outputs, final_states, sequence_lengths)` ) \
when `return_length` is True, otherwise a tuple( :code:`(final_outputs, final_states)` ). \ - final_outputs (Tensor, nested structure of Tensor), each Tensor in :code:`final_outputs` is the stacked of all decoding steps' outputs, which might be revised
The final outputs and states, both are Tensor or nested structure of Tensor. \ by :code:`decoder.finalize()` if the decoder has implemented finalize.
`final_outputs` has the same structure and data types as the :code:`outputs` \ And :code:`final_outputs` has the same structure and data types as the :code:`outputs`
returned by :code:`decoder.step()` , and each Tenser in `final_outputs` \ returned by :code:`decoder.step()`
is the stacked of all decoding steps' outputs, which might be revised \ - final_states (Tensor, nested structure of Tensor), :code:`final_states` is the counterpart at last time step of initial states \
by :code:`decoder.finalize()` if the decoder has implemented `finalize`. \ returned by :code:`decoder.initialize()` , thus has the same structure
`final_states` is the counterpart at last time step of initial states \ with it and has tensors with same shapes and data types.
returned by :code:`decoder.initialize()` , thus has the same structure \ - sequence_lengths (Tensor), stores the actual lengths of all decoded sequences.
with it and has tensors with same shapes and data types. `sequence_lengths` \ sequence_lengths is provided only if :code:`return_length` is True.
is an `int64` tensor with the same shape as `finished` returned \
by :code:`decoder.initialize()` , and it stores the actual lengths of \
all decoded sequences.
Examples: Examples:
.. code-block:: python .. code-block:: python
import numpy as np
import paddle import paddle
from paddle.nn import BeamSearchDecoder, dynamic_decode from paddle.nn import BeamSearchDecoder, dynamic_decode
from paddle.nn import GRUCell, Linear, Embedding from paddle.nn import GRUCell, Linear, Embedding
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册