@@ -46,16 +46,15 @@ class BeamSearchDecoderState(
46
46
):
47
47
"""State of a `BeamSearchDecoder`.
48
48
49
- Contains:
50
-
51
- - `cell_state`: The cell state returned at the previous time step.
52
- - `log_probs`: The accumulated log probabilities of each beam.
49
+ Attributes:
50
+ cell_state: The cell state returned at the previous time step.
51
+ log_probs: The accumulated log probabilities of each beam.
53
52
A `float32` `Tensor` of shape `[batch_size, beam_width]`.
54
- - ` finished` : The finished status of each beam.
53
+ finished: The finished status of each beam.
55
54
A `bool` `Tensor` of shape `[batch_size, beam_width]`.
56
- - ` lengths` : The accumulated length of each beam.
55
+ lengths: The accumulated length of each beam.
57
56
An `int64` `Tensor` of shape `[batch_size, beam_width]`.
58
- - ` accumulated_attention_prob` : Accumulation of the attention
57
+ accumulated_attention_prob: Accumulation of the attention
59
58
probabilities (used to compute the coverage penalty)
60
59
"""
61
60
@@ -69,19 +68,18 @@ class BeamSearchDecoderOutput(
69
68
):
70
69
"""Outputs of a `BeamSearchDecoder` step.
71
70
72
- Contains:
73
-
74
- - `scores`: The scores this step, which are the log
71
+ Attributes:
72
+ scores: The scores this step, which are the log
75
73
probabilities over the output vocabulary, possibly penalized by length
76
74
and attention coverage. When `BeamSearchDecoder` is created with
77
75
`output_all_scores=False` (default), this will be a `float32` `Tensor`
78
76
of shape `[batch_size, beam_width]` containing the top scores
79
77
corresponding to the predicted IDs. When `output_all_scores=True`,
80
78
this contains the scores for all token IDs and has shape
81
79
`[batch_size, beam_width, vocab_size]`.
82
- - ` predicted_ids` : The token IDs predicted for this step.
80
+ predicted_ids: The token IDs predicted for this step.
83
81
A `int32` `Tensor` of shape `[batch_size, beam_width]`.
84
- - ` parent_ids` : The indices of the parent beam of each beam.
82
+ parent_ids: The indices of the parent beam of each beam.
85
83
A `int32` `Tensor` of shape `[batch_size, beam_width]`.
86
84
"""
87
85
@@ -93,10 +91,9 @@ class FinalBeamSearchDecoderOutput(
93
91
"FinalBeamDecoderOutput" , ["predicted_ids" , "beam_search_decoder_output" ]
94
92
)
95
93
):
96
- """Final outputs returned by the beam search after all decoding is
97
- finished.
94
+ """Final outputs returned by the beam search after all decoding is finished.
98
95
99
- Args :
96
+ Attributes :
100
97
predicted_ids: The final prediction. A tensor of shape
101
98
`[batch_size, T, beam_width]` (or `[T, batch_size, beam_width]` if
102
99
`output_time_major` is True). Beams are ordered from best to worst.
0 commit comments