未验证 提交 8c416653 编写于 作者: L liu zhengxi 提交者: GitHub

refine bsd doc (#48882)

上级 93acef3b
...@@ -26,8 +26,6 @@ __all__ = [] ...@@ -26,8 +26,6 @@ __all__ = []
class Decoder: class Decoder:
""" """
:api_attr: Static Graph
Decoder is the base class for any decoder instance used in `dynamic_decode`. Decoder is the base class for any decoder instance used in `dynamic_decode`.
It provides interface for output generation for one time step, which can be It provides interface for output generation for one time step, which can be
used to generate sequences. used to generate sequences.
...@@ -146,13 +144,14 @@ class BeamSearchDecoder(Decoder): ...@@ -146,13 +144,14 @@ class BeamSearchDecoder(Decoder):
Please refer to `Beam search <https://en.wikipedia.org/wiki/Beam_search>`_ Please refer to `Beam search <https://en.wikipedia.org/wiki/Beam_search>`_
for more details. for more details.
**NOTE** When decoding with beam search, the `inputs` and `states` of cell Note:
would be tiled to `beam_size` (unsqueeze and tile), resulting to shapes like When decoding with beam search, the `inputs` and `states` of cell
`[batch_size * beam_size, ...]` , which is built into `BeamSearchDecoder` and would be tiled to `beam_size` (unsqueeze and tile), resulting to shapes like
done automatically. Thus any other tensor with shape `[batch_size, ...]` used `[batch_size * beam_size, ...]` , which is built into `BeamSearchDecoder` and
in `cell.call` needs to be tiled manually first, which can be completed by using done automatically. Thus any other tensor with shape `[batch_size, ...]` used
:code:`BeamSearchDecoder.tile_beam_merge_with_batch` . The most common case in `cell.call` needs to be tiled manually first, which can be completed by using
for this is the encoder output in attention mechanism. :code:`BeamSearchDecoder.tile_beam_merge_with_batch` . The most common case
for this is the encoder output in attention mechanism.
Returns: Returns:
BeamSearchDecoder: An instance of decoder which can be used in \ BeamSearchDecoder: An instance of decoder which can be used in \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册