@@ -5135,12 +5135,19 @@ def block_expand_layer(input,
5135
5135
@layer_support ()
5136
5136
def maxout_layer (input , groups , num_channels = None , name = None , layer_attr = None ):
5137
5137
"""
5138
- A layer to do max out on conv layer output.
5139
- - Input: output of a conv layer.
5140
- - Output: feature map size same as input. Channel is (input channel) / groups.
5138
+ A layer to do max out on convolutional layer output.
5139
+ - Input: the output of a convolutional layer.
5140
+ - Output: feature map size same as the input's, and its channel number is
5141
+ (input channel) / groups.
5141
5142
5142
5143
So groups should be larger than 1, and the num of channels should be able
5143
- to devided by groups.
5144
+ to be devided by groups.
5145
+
5146
+ Reference:
5147
+ Maxout Networks
5148
+ http://www.jmlr.org/proceedings/papers/v28/goodfellow13.pdf
5149
+ Multi-digit Number Recognition from Street View Imagery using Deep Convolutional Neural Networks
5150
+ https://arxiv.org/pdf/1312.6082v4.pdf
5144
5151
5145
5152
.. math::
5146
5153
y_{si+j} = \max_k x_{gsi + sk + j}
@@ -5150,12 +5157,6 @@ def maxout_layer(input, groups, num_channels=None, name=None, layer_attr=None):
5150
5157
0 \le j < s
5151
5158
0 \le k < groups
5152
5159
5153
- Please refer to Paper:
5154
- - Maxout Networks: http://www.jmlr.org/proceedings/papers/v28/goodfellow13.pdf
5155
- - Multi-digit Number Recognition from Street View \
5156
- Imagery using Deep Convolutional Neural Networks: \
5157
- https://arxiv.org/pdf/1312.6082v4.pdf
5158
-
5159
5160
The simple usage is:
5160
5161
5161
5162
.. code-block:: python
@@ -5166,14 +5167,16 @@ def maxout_layer(input, groups, num_channels=None, name=None, layer_attr=None):
5166
5167
5167
5168
:param input: The input of this layer.
5168
5169
:type input: LayerOutput
5169
- :param num_channels: The channel number of input layer. If None will be set
5170
- automatically from previous output.
5171
- :type num_channels: int | None
5170
+ :param num_channels: The number of input channels. If the parameter is not set or
5171
+ set to None, its actual value will be automatically set to
5172
+ the channels number of the input.
5173
+ :type num_channels: int
5172
5174
:param groups: The group number of input layer.
5173
5175
:type groups: int
5174
5176
:param name: The name of this layer. It is optional.
5175
- :type name: None | basestring.
5176
- :param layer_attr: Extra Layer attribute.
5177
+ :type name: basestring
5178
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
5179
+ details.
5177
5180
:type layer_attr: ExtraLayerAttribute
5178
5181
:return: LayerOutput object.
5179
5182
:rtype: LayerOutput
@@ -5205,20 +5208,20 @@ def ctc_layer(input,
5205
5208
layer_attr = None ):
5206
5209
"""
5207
5210
Connectionist Temporal Classification (CTC) is designed for temporal
5208
- classication task. That is, for sequence labeling problems where the
5211
+ classication task. e.g. sequence labeling problems where the
5209
5212
alignment between the inputs and the target labels is unknown.
5210
5213
5211
- More details can be found by referring to `Connectionist Temporal
5212
- Classification: Labelling Unsegmented Sequence Data with Recurrent
5213
- Neural Networks <http://machinelearning.wustl.edu/mlpapers/paper_files/
5214
- icml2006_GravesFGS06.pdf>`_
5214
+ Reference:
5215
+ Connectionist Temporal Classification: Labelling Unsegmented Sequence Data
5216
+ with Recurrent Neural Networks
5217
+ http://machinelearning.wustl.edu/mlpapers/paper_files/ icml2006_GravesFGS06.pdf
5215
5218
5216
5219
Note:
5217
- Considering the 'blank' label needed by CTC, you need to use
5218
- (num_classes + 1) as the input size. num_classes is the category number.
5219
- And the 'blank' is the last category index. So the size of 'input' layer, such as
5220
- fc_layer with softmax activation, should be num_classes + 1. The size of ctc_layer
5221
- should also be num_classes + 1.
5220
+ Considering the 'blank' label needed by CTC, you need to use (num_classes + 1)
5221
+ as the size of the input, where num_classes is the category number.
5222
+ And the 'blank' is the last category index. So the size of 'input' layer (e.g.
5223
+ fc_layer with softmax activation) should be ( num_classes + 1) . The size of
5224
+ ctc_layer should also be ( num_classes + 1) .
5222
5225
5223
5226
The example usage is:
5224
5227
@@ -5231,16 +5234,17 @@ def ctc_layer(input,
5231
5234
5232
5235
:param input: The input of this layer.
5233
5236
:type input: LayerOutput
5234
- :param label: The data layer of label with variable length .
5237
+ :param label: The input label.
5235
5238
:type label: LayerOutput
5236
- :param size: category numbers + 1.
5239
+ :param size: The dimension of this layer, which must be equal to ( category number + 1) .
5237
5240
:type size: int
5238
5241
:param name: The name of this layer. It is optional.
5239
- :type name: basestring | None
5240
- :param norm_by_times: Whether to normalization by times. False by default.
5242
+ :type name: basestring
5243
+ :param norm_by_times: Whether to do normalization by times. False is the default.
5241
5244
:type norm_by_times: bool
5242
- :param layer_attr: Extra Layer config.
5243
- :type layer_attr: ExtraLayerAttribute | None
5245
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
5246
+ details.
5247
+ :type layer_attr: ExtraLayerAttribute
5244
5248
:return: LayerOutput object.
5245
5249
:rtype: LayerOutput
5246
5250
"""
@@ -5281,20 +5285,19 @@ def warp_ctc_layer(input,
5281
5285
building process, PaddlePaddle will clone the source codes, build and
5282
5286
install it to :code:`third_party/install/warpctc` directory.
5283
5287
5284
- More details of CTC can be found by referring to `Connectionist Temporal
5285
- Classification: Labelling Unsegmented Sequence Data with Recurrent
5286
- Neural Networks <http://machinelearning.wustl.edu/mlpapers/paper_files/
5287
- icml2006_GravesFGS06.pdf>`_.
5288
+ Reference:
5289
+ Connectionist Temporal Classification: Labelling Unsegmented Sequence Data
5290
+ with Recurrent Neural Networks
5291
+ http://machinelearning.wustl.edu/mlpapers/paper_files/ icml2006_GravesFGS06.pdf
5288
5292
5289
5293
Note:
5290
- - Let num_classes represent the category number. Considering the 'blank'
5291
- label needed by CTC, you need to use (num_classes + 1) as the input size.
5292
- Thus, the size of both warp_ctc layer and 'input' layer should be set to
5293
- num_classes + 1.
5294
+ - Let num_classes represents the category number. Considering the 'blank'
5295
+ label needed by CTC, you need to use (num_classes + 1) as the size of
5296
+ warp_ctc layer.
5294
5297
- You can set 'blank' to any value ranged in [0, num_classes], which
5295
- should be consistent as that used in your labels.
5298
+ should be consistent with those used in your labels.
5296
5299
- As a native 'softmax' activation is interated to the warp-ctc library,
5297
- 'linear' activation is expected instead in the 'input' layer.
5300
+ 'linear' activation is expected to be used instead in the 'input' layer.
5298
5301
5299
5302
The example usage is:
5300
5303
@@ -5308,18 +5311,19 @@ def warp_ctc_layer(input,
5308
5311
5309
5312
:param input: The input of this layer.
5310
5313
:type input: LayerOutput
5311
- :param label: The data layer of label with variable length .
5314
+ :param label: The input label.
5312
5315
:type label: LayerOutput
5313
- :param size: category numbers + 1.
5316
+ :param size: The dimension of this layer, which must be equal to ( category number + 1) .
5314
5317
:type size: int
5315
5318
:param name: The name of this layer. It is optional.
5316
- :type name: basestring | None
5317
- :param blank: the 'blank' label used in ctc
5319
+ :type name: basestring
5320
+ :param blank: The 'blank' label used in ctc.
5318
5321
:type blank: int
5319
- :param norm_by_times: Whether to normalization by times. False by default.
5322
+ :param norm_by_times: Whether to do normalization by times. False is the default.
5320
5323
:type norm_by_times: bool
5321
- :param layer_attr: Extra Layer config.
5322
- :type layer_attr: ExtraLayerAttribute | None
5324
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
5325
+ details.
5326
+ :type layer_attr: ExtraLayerAttribute
5323
5327
:return: LayerOutput object.
5324
5328
:rtype: LayerOutput
5325
5329
"""
@@ -5365,23 +5369,25 @@ def crf_layer(input,
5365
5369
label=label,
5366
5370
size=label_dim)
5367
5371
5368
- :param input: The first input layer is the feature .
5372
+ :param input: The first input layer.
5369
5373
:type input: LayerOutput
5370
- :param label: The second input layer is label.
5374
+ :param label: The input label.
5371
5375
:type label: LayerOutput
5372
5376
:param size: The category number.
5373
5377
:type size: int
5374
- :param weight: The third layer is "weight" of each sample, which is an
5375
- optional argument.
5378
+ :param weight: The scale of the cost of each sample. It is optional.
5376
5379
:type weight: LayerOutput
5377
- :param param_attr: Parameter attribute. None means default attribute
5380
+ :param param_attr: The parameter attribute. See ParameterAttribute for
5381
+ details.
5378
5382
:type param_attr: ParameterAttribute
5379
5383
:param name: The name of this layer. It is optional.
5380
- :type name: None | basestring
5381
- :param coeff: The coefficient affects the gradient in the backward.
5384
+ :type name: basestring
5385
+ :param coeff: The weight of the gradient in the back propagation.
5386
+ 1.0 is the default.
5382
5387
:type coeff: float
5383
- :param layer_attr: Extra Layer config.
5384
- :type layer_attr: ExtraLayerAttribute | None
5388
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
5389
+ details.
5390
+ :type layer_attr: ExtraLayerAttribute
5385
5391
:return: LayerOutput object.
5386
5392
:rtype: LayerOutput
5387
5393
"""
@@ -5427,9 +5433,9 @@ def crf_decoding_layer(input,
5427
5433
"""
5428
5434
A layer for calculating the decoding sequence of sequential conditional
5429
5435
random field model. The decoding sequence is stored in output.ids.
5430
- If a second input is provided, it is treated as the ground-truth label, and
5431
- this layer will also calculate error. output.value[i] is 1 for incorrect
5432
- decoding or 0 for correct decoding .
5436
+ If the input 'label' is provided, it is treated as the ground-truth label, and
5437
+ this layer will also calculate error. output.value[i] is 1 for an incorrect
5438
+ decoding and 0 for the correct .
5433
5439
5434
5440
The example usage is:
5435
5441
@@ -5440,16 +5446,18 @@ def crf_decoding_layer(input,
5440
5446
5441
5447
:param input: The first input layer.
5442
5448
:type input: LayerOutput
5443
- :param size: size of this layer.
5449
+ :param size: The dimension of this layer.
5444
5450
:type size: int
5445
- :param label: None or ground-truth label.
5446
- :type label: LayerOutput or None
5447
- :param param_attr: Parameter attribute. None means default attribute
5451
+ :param label: The input label.
5452
+ :type label: LayerOutput | None
5453
+ :param param_attr: The parameter attribute. See ParameterAttribute for
5454
+ details.
5448
5455
:type param_attr: ParameterAttribute
5449
5456
:param name: The name of this layer. It is optional.
5450
- :type name: None | basestring
5451
- :param layer_attr: Extra Layer config.
5452
- :type layer_attr: ExtraLayerAttribute | None
5457
+ :type name: basestring
5458
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
5459
+ details.
5460
+ :type layer_attr: ExtraLayerAttribute
5453
5461
:return: LayerOutput object.
5454
5462
:rtype: LayerOutput
5455
5463
"""
@@ -5494,8 +5502,10 @@ def nce_layer(input,
5494
5502
layer_attr = None ):
5495
5503
"""
5496
5504
Noise-contrastive estimation.
5497
- Implements the method in the following paper:
5498
- A fast and simple algorithm for training neural probabilistic language models.
5505
+
5506
+ Reference:
5507
+ A fast and simple algorithm for training neural probabilistic language models.
5508
+ http://www.icml.cc/2012/papers/855.pdf
5499
5509
5500
5510
The example usage is:
5501
5511
@@ -5507,31 +5517,33 @@ def nce_layer(input,
5507
5517
5508
5518
:param name: The name of this layer. It is optional.
5509
5519
:type name: basestring
5510
- :param input: The input layers. It could be a LayerOutput of list/tuple of LayerOutput .
5520
+ :param input: The first input of this layer .
5511
5521
:type input: LayerOutput | list | tuple | collections.Sequence
5512
- :param label: label layer
5522
+ :param label: The input label.
5513
5523
:type label: LayerOutput
5514
- :param weight: weight layer, can be None(default)
5524
+ :param weight: The scale of the cost. It is optional.
5515
5525
:type weight: LayerOutput
5516
- :param num_classes: number of classes.
5526
+ :param num_classes: The number of classes.
5517
5527
:type num_classes: int
5518
5528
:param act: Activation type. SigmoidActivation is the default.
5519
5529
:type act: BaseActivation
5520
- :param param_attr: The Parameter Attribute|list.
5530
+ :param param_attr: The parameter attribute. See ParameterAttribute for
5531
+ details.
5521
5532
:type param_attr: ParameterAttribute
5522
- :param num_neg_samples: number of negative samples. Default is 10 .
5533
+ :param num_neg_samples: The number of negative samples. 10 is the default .
5523
5534
:type num_neg_samples: int
5524
- :param neg_distribution: The distribution for generating the random negative labels.
5525
- A uniform distribution will be used if not provided.
5526
- If not None, its length must be equal to num_classes.
5535
+ :param neg_distribution: The probability distribution for generating the random negative
5536
+ labels. If this parameter is not set, a uniform distribution will
5537
+ be used. If not None, its length must be equal to num_classes.
5527
5538
:type neg_distribution: list | tuple | collections.Sequence | None
5528
5539
:param bias_attr: The bias attribute. If the parameter is set to False or an object
5529
5540
whose type is not ParameterAttribute, no bias is defined. If the
5530
5541
parameter is set to True, the bias is initialized to zero.
5531
5542
:type bias_attr: ParameterAttribute | None | bool | Any
5532
- :param layer_attr: Extra Layer Attribute.
5543
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
5544
+ details.
5533
5545
:type layer_attr: ExtraLayerAttribute
5534
- :return: layer name .
5546
+ :return: LayerOutput object .
5535
5547
:rtype: LayerOutput
5536
5548
"""
5537
5549
if isinstance (input , LayerOutput ):
@@ -5605,11 +5617,11 @@ def rank_cost(left,
5605
5617
coeff = 1.0 ,
5606
5618
layer_attr = None ):
5607
5619
"""
5608
- A cost Layer for learning to rank using gradient descent. Details can refer
5609
- to `papers <http://research.microsoft.com/en-us/um/people/cburges/papers/
5610
- ICML_ranking.pdf>`_.
5611
- This layer contains at least three inputs. The weight is an optional
5612
- argument, which affects the cost.
5620
+ A cost Layer for learning to rank using gradient descent.
5621
+
5622
+ Reference:
5623
+ Learning to Rank using Gradient Descent
5624
+ http://research.microsoft.com/en-us/um/people/cburges/papers/ICML_ranking.pdf
5613
5625
5614
5626
.. math::
5615
5627
@@ -5640,14 +5652,15 @@ def rank_cost(left,
5640
5652
:type right: LayerOutput
5641
5653
:param label: Label is 1 or 0, means positive order and reverse order.
5642
5654
:type label: LayerOutput
5643
- :param weight: The weight affects the cost, namely the scale of cost.
5644
- It is an optional argument.
5655
+ :param weight: The scale of cost. It is optional.
5645
5656
:type weight: LayerOutput
5646
5657
:param name: The name of this layer. It is optional.
5647
- :type name: None | basestring
5648
- :param coeff: The coefficient affects the gradient in the backward.
5658
+ :type name: basestring
5659
+ :param coeff: The weight of the gradient in the back propagation.
5660
+ 1.0 is the default.
5649
5661
:type coeff: float
5650
- :param layer_attr: Extra Layer Attribute.
5662
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
5663
+ details.
5651
5664
:type layer_attr: ExtraLayerAttribute
5652
5665
:return: LayerOutput object.
5653
5666
:rtype: LayerOutput
@@ -5692,25 +5705,25 @@ def lambda_cost(input,
5692
5705
NDCG_num=8,
5693
5706
max_sort_size=-1)
5694
5707
5695
- :param input: Samples of the same query should be loaded as sequence.
5708
+ :param input: The first input of this layer, which is often a document
5709
+ samples list of the same query and whose type must be sequence.
5696
5710
:type input: LayerOutput
5697
- :param score: The 2nd input. Score of each sample .
5711
+ :param score: The scores of the samples .
5698
5712
:type input: LayerOutput
5699
5713
:param NDCG_num: The size of NDCG (Normalized Discounted Cumulative Gain),
5700
5714
e.g., 5 for NDCG@5. It must be less than or equal to the
5701
- minimum size of lists .
5715
+ minimum size of the list .
5702
5716
:type NDCG_num: int
5703
- :param max_sort_size: The size of partial sorting in calculating gradient.
5704
- If max_sort_size = -1, then for each list, the
5705
- algorithm will sort the entire list to get gradient.
5706
- In other cases, max_sort_size must be greater than or
5707
- equal to NDCG_num. And if max_sort_size is greater
5708
- than the size of a list, the algorithm will sort the
5709
- entire list of get gradient.
5717
+ :param max_sort_size: The size of partial sorting in calculating gradient. If
5718
+ max_sort_size is equal to -1 or greater than the number
5719
+ of the samples in the list, then the algorithm will sort
5720
+ the entire list to compute the gradient. In other cases,
5721
+ max_sort_size must be greater than or equal to NDCG_num.
5710
5722
:type max_sort_size: int
5711
5723
:param name: The name of this layer. It is optional.
5712
- :type name: None | basestring
5713
- :param layer_attr: Extra Layer Attribute.
5724
+ :type name: basestring
5725
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
5726
+ details.
5714
5727
:type layer_attr: ExtraLayerAttribute
5715
5728
:return: LayerOutput object.
5716
5729
:rtype: LayerOutput
@@ -6830,8 +6843,8 @@ def img_conv3d_layer(input,
6830
6843
parameter is set to True, the bias is initialized to zero.
6831
6844
:type bias_attr: ParameterAttribute | None | bool | Any
6832
6845
:param num_channels: The number of input channels. If the parameter is not set or
6833
- set to None, its actual value will be automatically set to
6834
- the channels number of the input .
6846
+ set to None, its actual value will be automatically set to
6847
+ the channels number of the input.
6835
6848
:type num_channels: int
6836
6849
:param param_attr: The parameter attribute of the convolution. See ParameterAttribute for
6837
6850
details.
0 commit comments