Skip to content

Commit 95c201d

Browse files
committed
update generated layers
1 parent d1577a1 commit 95c201d

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

nn/_generated_layers.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
This file is auto-generated by _generate_layers.py.
3-
RETURNN: 1.20220211.120126+git.a10e882
3+
RETURNN: 1.20220214.111744+git.c52d07b
44
55
These are the RETURNN layers directly wrapped.
66
Note that we intentionally exclude some layers or options for more consistency.
@@ -2199,6 +2199,7 @@ def choice(
21992199
beam_size: int,
22002200
keep_beams: bool = NotSpecified,
22012201
search: Union[NotSpecified, bool] = NotSpecified,
2202+
add_to_beam_scores: Union[NotSpecified, bool] = NotSpecified,
22022203
input_type: str = NotSpecified,
22032204
prob_scale: float = NotSpecified,
22042205
base_beam_score_scale: float = NotSpecified,
@@ -2240,6 +2241,11 @@ def choice(
22402241
i.e. we just expand, i.e. we just search on the dim. beam_size must be a multiple of beam_in.
22412242
:param NotSpecified|bool search: whether to perform search, or use the ground truth (`target` option).
22422243
If not specified, it will depend on `network.search_flag`.
2244+
:param NotSpecified|bool add_to_beam_scores: whether to add the scores to the beam scores.
2245+
This will be done with search obviously (not supported to not do it).
2246+
Without search, we can still add the scores of the ground-truth labels to the beam.
2247+
By default, this is derived from `search or network.search_flag`.
2248+
So with enabled net search flag, even when `search` is disabled here, it will add the scores.
22432249
:param str input_type: "prob" or "log_prob", whether the input is in probability space, log-space, etc.
22442250
or "regression", if it is a prediction of the data as-is. If there are several inputs, same format
22452251
for all is assumed.
@@ -2264,6 +2270,7 @@ def choice(
22642270
'beam_size': beam_size,
22652271
'keep_beams': keep_beams,
22662272
'search': search,
2273+
'add_to_beam_scores': add_to_beam_scores,
22672274
'input_type': input_type,
22682275
'prob_scale': prob_scale,
22692276
'base_beam_score_scale': base_beam_score_scale,
@@ -2289,6 +2296,7 @@ def decide(
22892296
*,
22902297
length_normalization: bool = NotSpecified,
22912298
search: Union[NotSpecified, bool] = NotSpecified,
2299+
add_to_beam_scores: Union[NotSpecified, bool] = NotSpecified,
22922300
name: Optional[Union[str, nn.NameCtx]] = None) -> nn.Tensor:
22932301
"""
22942302
This is kind of the counter-part to the choice layer.
@@ -2303,12 +2311,18 @@ def decide(
23032311
:param bool length_normalization: performed on the beam scores
23042312
:param NotSpecified|bool search: whether to perform search, or use the ground truth (`target` option).
23052313
If not specified, it will depend on `network.search_flag`.
2314+
:param NotSpecified|bool add_to_beam_scores: whether to add the scores to the beam scores.
2315+
This will be done with search obviously (not supported to not do it).
2316+
Without search, we can still add the scores of the ground-truth labels to the beam.
2317+
By default, this is derived from `search or network.search_flag`.
2318+
So with enabled net search flag, even when `search` is disabled here, it will add the scores.
23062319
:param str|nn.NameCtx|None name:
23072320
:return: layer
23082321
"""
23092322
args = {
23102323
'length_normalization': length_normalization,
23112324
'search': search,
2325+
'add_to_beam_scores': add_to_beam_scores,
23122326
}
23132327
args = {key: value for (key, value) in args.items() if value is not NotSpecified}
23142328
return nn.make_layer({
@@ -2366,6 +2380,7 @@ def split_batch_beam(
23662380
*,
23672381
beam_dim: Optional[nn.Dim] = NotSpecified,
23682382
search: Union[NotSpecified, bool] = NotSpecified,
2383+
add_to_beam_scores: Union[NotSpecified, bool] = NotSpecified,
23692384
name: Optional[Union[str, nn.NameCtx]] = None) -> Tuple[nn.Tensor, nn.Dim]:
23702385
"""
23712386
Splits the batch dimension of the input, which includes a beam, into (batch,beam).
@@ -2376,6 +2391,11 @@ def split_batch_beam(
23762391
:param nn.Dim|None beam_dim:
23772392
:param NotSpecified|bool search: whether to perform search, or use the ground truth (`target` option).
23782393
If not specified, it will depend on `network.search_flag`.
2394+
:param NotSpecified|bool add_to_beam_scores: whether to add the scores to the beam scores.
2395+
This will be done with search obviously (not supported to not do it).
2396+
Without search, we can still add the scores of the ground-truth labels to the beam.
2397+
By default, this is derived from `search or network.search_flag`.
2398+
So with enabled net search flag, even when `search` is disabled here, it will add the scores.
23792399
:param str|nn.NameCtx|None name:
23802400
:return: layer, beam_dim
23812401
"""
@@ -2384,6 +2404,7 @@ def split_batch_beam(
23842404
args = {
23852405
'beam_dim': beam_dim,
23862406
'search': search,
2407+
'add_to_beam_scores': add_to_beam_scores,
23872408
}
23882409
args = {key: value for (key, value) in args.items() if value is not NotSpecified}
23892410
layer = nn.make_layer({

0 commit comments

Comments
 (0)