|
26 | 26 |
|
27 | 27 | class Decoder: |
28 | 28 | """ |
29 | | - :api_attr: Static Graph |
30 | | -
|
31 | 29 | Decoder is the base class for any decoder instance used in `dynamic_decode`. |
32 | 30 | It provides interface for output generation for one time step, which can be |
33 | 31 | used to generate sequences. |
@@ -146,13 +144,14 @@ class BeamSearchDecoder(Decoder): |
146 | 144 | Please refer to `Beam search <https://en.wikipedia.org/wiki/Beam_search>`_ |
147 | 145 | for more details. |
148 | 146 |
|
149 | | - **NOTE** When decoding with beam search, the `inputs` and `states` of cell |
150 | | - would be tiled to `beam_size` (unsqueeze and tile), resulting to shapes like |
151 | | - `[batch_size * beam_size, ...]` , which is built into `BeamSearchDecoder` and |
152 | | - done automatically. Thus any other tensor with shape `[batch_size, ...]` used |
153 | | - in `cell.call` needs to be tiled manually first, which can be completed by using |
154 | | - :code:`BeamSearchDecoder.tile_beam_merge_with_batch` . The most common case |
155 | | - for this is the encoder output in attention mechanism. |
| 147 | + Note: |
| 148 | + When decoding with beam search, the `inputs` and `states` of cell |
| 149 | + would be tiled to `beam_size` (unsqueeze and tile), resulting to shapes like |
| 150 | + `[batch_size * beam_size, ...]` , which is built into `BeamSearchDecoder` and |
| 151 | + done automatically. Thus any other tensor with shape `[batch_size, ...]` used |
| 152 | + in `cell.call` needs to be tiled manually first, which can be completed by using |
| 153 | + :code:`BeamSearchDecoder.tile_beam_merge_with_batch` . The most common case |
| 154 | + for this is the encoder output in attention mechanism. |
156 | 155 |
|
157 | 156 | Returns: |
158 | 157 | BeamSearchDecoder: An instance of decoder which can be used in \ |
|
0 commit comments