1
1
"""
2
2
This file is auto-generated by _generate_layers.py.
3
- RETURNN: 1.20220211.120126 +git.a10e882
3
+ RETURNN: 1.20220214.111744 +git.c52d07b
4
4
5
5
These are the RETURNN layers directly wrapped.
6
6
Note that we intentionally exclude some layers or options for more consistency.
@@ -2199,6 +2199,7 @@ def choice(
2199
2199
beam_size : int ,
2200
2200
keep_beams : bool = NotSpecified ,
2201
2201
search : Union [NotSpecified , bool ] = NotSpecified ,
2202
+ add_to_beam_scores : Union [NotSpecified , bool ] = NotSpecified ,
2202
2203
input_type : str = NotSpecified ,
2203
2204
prob_scale : float = NotSpecified ,
2204
2205
base_beam_score_scale : float = NotSpecified ,
@@ -2240,6 +2241,11 @@ def choice(
2240
2241
i.e. we just expand, i.e. we just search on the dim. beam_size must be a multiple of beam_in.
2241
2242
:param NotSpecified|bool search: whether to perform search, or use the ground truth (`target` option).
2242
2243
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.
2243
2249
:param str input_type: "prob" or "log_prob", whether the input is in probability space, log-space, etc.
2244
2250
or "regression", if it is a prediction of the data as-is. If there are several inputs, same format
2245
2251
for all is assumed.
@@ -2264,6 +2270,7 @@ def choice(
2264
2270
'beam_size' : beam_size ,
2265
2271
'keep_beams' : keep_beams ,
2266
2272
'search' : search ,
2273
+ 'add_to_beam_scores' : add_to_beam_scores ,
2267
2274
'input_type' : input_type ,
2268
2275
'prob_scale' : prob_scale ,
2269
2276
'base_beam_score_scale' : base_beam_score_scale ,
@@ -2289,6 +2296,7 @@ def decide(
2289
2296
* ,
2290
2297
length_normalization : bool = NotSpecified ,
2291
2298
search : Union [NotSpecified , bool ] = NotSpecified ,
2299
+ add_to_beam_scores : Union [NotSpecified , bool ] = NotSpecified ,
2292
2300
name : Optional [Union [str , nn .NameCtx ]] = None ) -> nn .Tensor :
2293
2301
"""
2294
2302
This is kind of the counter-part to the choice layer.
@@ -2303,12 +2311,18 @@ def decide(
2303
2311
:param bool length_normalization: performed on the beam scores
2304
2312
:param NotSpecified|bool search: whether to perform search, or use the ground truth (`target` option).
2305
2313
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.
2306
2319
:param str|nn.NameCtx|None name:
2307
2320
:return: layer
2308
2321
"""
2309
2322
args = {
2310
2323
'length_normalization' : length_normalization ,
2311
2324
'search' : search ,
2325
+ 'add_to_beam_scores' : add_to_beam_scores ,
2312
2326
}
2313
2327
args = {key : value for (key , value ) in args .items () if value is not NotSpecified }
2314
2328
return nn .make_layer ({
@@ -2366,6 +2380,7 @@ def split_batch_beam(
2366
2380
* ,
2367
2381
beam_dim : Optional [nn .Dim ] = NotSpecified ,
2368
2382
search : Union [NotSpecified , bool ] = NotSpecified ,
2383
+ add_to_beam_scores : Union [NotSpecified , bool ] = NotSpecified ,
2369
2384
name : Optional [Union [str , nn .NameCtx ]] = None ) -> Tuple [nn .Tensor , nn .Dim ]:
2370
2385
"""
2371
2386
Splits the batch dimension of the input, which includes a beam, into (batch,beam).
@@ -2376,6 +2391,11 @@ def split_batch_beam(
2376
2391
:param nn.Dim|None beam_dim:
2377
2392
:param NotSpecified|bool search: whether to perform search, or use the ground truth (`target` option).
2378
2393
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.
2379
2399
:param str|nn.NameCtx|None name:
2380
2400
:return: layer, beam_dim
2381
2401
"""
@@ -2384,6 +2404,7 @@ def split_batch_beam(
2384
2404
args = {
2385
2405
'beam_dim' : beam_dim ,
2386
2406
'search' : search ,
2407
+ 'add_to_beam_scores' : add_to_beam_scores ,
2387
2408
}
2388
2409
args = {key : value for (key , value ) in args .items () if value is not NotSpecified }
2389
2410
layer = nn .make_layer ({
0 commit comments