@@ -1900,9 +1900,12 @@ def repeat_layer(input,
1900
1900
A layer for repeating the input for num_repeats times.
1901
1901
1902
1902
If as_row_vector:
1903
+
1903
1904
.. math::
1904
1905
y = [x_1,\cdots, x_n, \cdots, x_1, \cdots, x_n]
1906
+
1905
1907
If not as_row_vector:
1908
+
1906
1909
.. math::
1907
1910
y = [x_1,\cdots, x_1, \cdots, x_n, \cdots, x_n]
1908
1911
@@ -1915,19 +1918,19 @@ def repeat_layer(input,
1915
1918
1916
1919
:param input: The input of this layer.
1917
1920
:type input: LayerOutput
1918
- :param num_repeats: Repeat the input so many times
1921
+ :param num_repeats: The times of repeating the input.
1919
1922
:type num_repeats: int
1920
1923
:param name: The name of this layer. It is optional.
1921
- :param as_row_vector: True for treating input as row vector and repeating
1922
- in the column direction. This is equivalent to apply
1923
- concat_layer() with num_repeats same input.
1924
- False for treating input as column vector and repeating
1925
- in the row direction.
1924
+ :type name: basestring
1925
+ :param as_row_vector: Whether to treat the input as row vectors or not. If
1926
+ the parameter is set to True, the repeating operation
1927
+ will be performed in the column direction. Otherwise,
1928
+ it will be performed in the row direction.
1926
1929
:type as_row_vector: bool
1927
1930
:param act: Activation type. IdentityActivation is the default activation.
1928
1931
:type act: BaseActivation
1929
- :type name: basestring
1930
- :param layer_attr: extra layer attributes .
1932
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
1933
+ details .
1931
1934
:type layer_attr: ExtraLayerAttribute.
1932
1935
:return: LayerOutput object.
1933
1936
:rtype: LayerOutput
@@ -1974,13 +1977,14 @@ def seq_reshape_layer(input,
1974
1977
1975
1978
:param input: The input of this layer.
1976
1979
:type input: LayerOutput
1977
- :param reshape_size: the size of reshaped sequence.
1980
+ :param reshape_size: The dimension of the reshaped sequence.
1978
1981
:type reshape_size: int
1979
1982
:param name: The name of this layer. It is optional.
1980
1983
:type name: basestring
1981
1984
:param act: Activation type. IdentityActivation is the default activation.
1982
1985
:type act: BaseActivation
1983
- :param layer_attr: extra layer attributes.
1986
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
1987
+ details.
1984
1988
:type layer_attr: ExtraLayerAttribute.
1985
1989
:param bias_attr: The bias attribute. If the parameter is set to False or an object
1986
1990
whose type is not ParameterAttribute, no bias is defined. If the
@@ -2008,7 +2012,7 @@ def seq_reshape_layer(input,
2008
2012
@layer_support ()
2009
2013
def interpolation_layer (input , weight , name = None , layer_attr = None ):
2010
2014
"""
2011
- This layer is for linear interpolation with two inputs,
2015
+ This layer performs linear interpolation on two inputs,
2012
2016
which is used in NEURAL TURING MACHINE.
2013
2017
2014
2018
.. math::
@@ -2030,7 +2034,8 @@ def interpolation_layer(input, weight, name=None, layer_attr=None):
2030
2034
:type weight: LayerOutput
2031
2035
:param name: The name of this layer. It is optional.
2032
2036
:type name: basestring
2033
- :param layer_attr: extra layer attributes.
2037
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
2038
+ details.
2034
2039
:type layer_attr: ExtraLayerAttribute.
2035
2040
:return: LayerOutput object.
2036
2041
:rtype: LayerOutput
@@ -2064,7 +2069,7 @@ def bilinear_interp_layer(input,
2064
2069
name = None ,
2065
2070
layer_attr = None ):
2066
2071
"""
2067
- This layer is to implement bilinear interpolation on conv layer output.
2072
+ This layer implements bilinear interpolation on convolutional layer's output.
2068
2073
2069
2074
Please refer to Wikipedia: https://en.wikipedia.org/wiki/Bilinear_interpolation
2070
2075
@@ -2074,18 +2079,19 @@ def bilinear_interp_layer(input,
2074
2079
2075
2080
bilinear = bilinear_interp_layer(input=layer1, out_size_x=64, out_size_y=64)
2076
2081
2077
- :param input: A input layer.
2078
- :type input: LayerOutput.
2079
- :param out_size_x: bilinear interpolation output width.
2080
- :type out_size_x: int | None
2081
- :param out_size_y: bilinear interpolation output height.
2082
- :type out_size_y: int | None
2083
- :param name: The layer's name, which cna not be specified.
2084
- :type name: None | basestring
2085
- :param layer_attr: Extra Layer attribute.
2086
- :type layer_attr: ExtraLayerAttribute
2082
+ :param input: The input of this layer.
2083
+ :type input: LayerOutput.
2084
+ :param out_size_x: The width of the output.
2085
+ :type out_size_x: int
2086
+ :param out_size_y: The height of the output.
2087
+ :type out_size_y: int
2088
+ :param name: The name of this layer. It is optional.
2089
+ :type name: basestring
2090
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
2091
+ details.
2092
+ :type layer_attr: ExtraLayerAttribute
2087
2093
:return: LayerOutput object.
2088
- :rtype: LayerOutput
2094
+ :rtype: LayerOutput
2089
2095
"""
2090
2096
assert input .layer_type == LayerType .CONV_LAYER
2091
2097
assert isinstance (input .activation , LinearActivation )
@@ -2120,8 +2126,8 @@ def power_layer(input, weight, name=None, layer_attr=None):
2120
2126
.. math::
2121
2127
y = x^w
2122
2128
2123
- where :math:`x` is a input vector, :math:`w` is scalar weight ,
2124
- and :math:`y` is a output vector.
2129
+ where :math:`x` is an input vector, :math:`w` is a scalar exponent ,
2130
+ and :math:`y` is an output vector.
2125
2131
2126
2132
The example usage is:
2127
2133
@@ -2131,11 +2137,12 @@ def power_layer(input, weight, name=None, layer_attr=None):
2131
2137
2132
2138
:param input: The input of this layer.
2133
2139
:type input: LayerOutput
2134
- :param weight: Weight layer .
2140
+ :param weight: The exponent of the power .
2135
2141
:type weight: LayerOutput
2136
2142
:param name: The name of this layer. It is optional.
2137
2143
:type name: basestring
2138
- :param layer_attr: extra layer attributes.
2144
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
2145
+ details.
2139
2146
:type layer_attr: ExtraLayerAttribute.
2140
2147
:return: LayerOutput object.
2141
2148
:rtype: LayerOutput
@@ -2175,11 +2182,12 @@ def scaling_layer(input, weight, name=None, layer_attr=None):
2175
2182
2176
2183
:param input: The input of this layer.
2177
2184
:type input: LayerOutput
2178
- :param weight: Weight layer .
2185
+ :param weight: The weight of each sample .
2179
2186
:type weight: LayerOutput
2180
2187
:param name: The name of this layer. It is optional.
2181
2188
:type name: basestring
2182
- :param layer_attr: extra layer attributes.
2189
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
2190
+ details.
2183
2191
:type layer_attr: ExtraLayerAttribute.
2184
2192
:return: LayerOutput object.
2185
2193
:rtype: LayerOutput
@@ -2217,7 +2225,8 @@ def trans_layer(input, name=None, layer_attr=None):
2217
2225
:type input: LayerOutput
2218
2226
:param name: The name of this layer. It is optional.
2219
2227
:type name: basestring
2220
- :param layer_attr: extra layer attributes.
2228
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
2229
+ details.
2221
2230
:type layer_attr: ExtraLayerAttribute.
2222
2231
:return: LayerOutput object.
2223
2232
:rtype: LayerOutput
@@ -2253,11 +2262,14 @@ def rotate_layer(input, height, width, name=None, layer_attr=None):
2253
2262
2254
2263
:param input: The input of this layer.
2255
2264
:type input: LayerOutput
2256
- :param height: The height of the sample matrix
2265
+ :param height: The height of the sample matrix.
2257
2266
:type height: int
2267
+ :param width: The width of the sample matrix.
2268
+ :type width: int
2258
2269
:param name: The name of this layer. It is optional.
2259
2270
:type name: basestring
2260
- :param layer_attr: extra layer attributes.
2271
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
2272
+ details.
2261
2273
:type layer_attr: ExtraLayerAttribute.
2262
2274
:return: LayerOutput object.
2263
2275
:rtype: LayerOutput
@@ -2302,15 +2314,15 @@ def cos_sim(a, b, scale=1, size=1, name=None, layer_attr=None):
2302
2314
2303
2315
:param name: The name of this layer. It is optional.
2304
2316
:type name: basestring
2305
- :param a: input layer a
2317
+ :param a: The first input of this layer.
2306
2318
:type a: LayerOutput
2307
- :param b: input layer b
2319
+ :param b: The second input of this layer.
2308
2320
:type b: LayerOutput
2309
- :param scale: scale for cosine value. default is 5 .
2321
+ :param scale: The scale of the cosine similarity. 1 is the default value .
2310
2322
:type scale: float
2311
- :param size: layer size . NOTE size_a * size should equal size_b.
2323
+ :param size: The dimension of this layer . NOTE size_a * size should equal size_b.
2312
2324
:type size: int
2313
- :param layer_attr: Extra Layer Attribute .
2325
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for details .
2314
2326
:type layer_attr: ExtraLayerAttribute
2315
2327
:return: LayerOutput object.
2316
2328
:rtype: LayerOutput
@@ -2395,8 +2407,10 @@ def hsigmoid(input,
2395
2407
"""
2396
2408
Organize the classes into a binary tree. At each node, a sigmoid function
2397
2409
is used to calculate the probability of belonging to the right branch.
2398
- This idea is from "F. Morin, Y. Bengio (AISTATS 05):
2399
- Hierarchical Probabilistic Neural Network Language Model."
2410
+
2411
+ Reference:
2412
+ `Hierarchical Probabilistic Neural Network Language Model
2413
+ <http://www.gatsby.ucl.ac.uk/aistats/fullpapers/208.pdf>`_
2400
2414
2401
2415
The example usage is:
2402
2416
@@ -2407,19 +2421,21 @@ def hsigmoid(input,
2407
2421
2408
2422
:param input: The input of this layer.
2409
2423
:type input: LayerOutput | list | tuple
2410
- :param label: Label layer .
2424
+ :param label: The input label .
2411
2425
:type label: LayerOutput
2412
- :param num_classes: number of classes.
2413
- :type num_classes: int | None
2426
+ :param num_classes: The number of classes. And it should be larger than 2. If the parameter
2427
+ is not set or set to None, its actual value will be automatically set to
2428
+ the number of labels.
2429
+ :type num_classes: int
2414
2430
:param name: The name of this layer. It is optional.
2415
2431
:type name: basestring
2416
2432
:param bias_attr: The bias attribute. If the parameter is set to False or an object
2417
2433
whose type is not ParameterAttribute, no bias is defined. If the
2418
2434
parameter is set to True, the bias is initialized to zero.
2419
2435
:type bias_attr: ParameterAttribute | None | bool | Any
2420
- :param param_attr: Parameter Attribute. None means default parameter .
2421
- :type param_attr: ParameterAttribute | None
2422
- :param layer_attr: Extra Layer Attribute .
2436
+ :param param_attr: The parameter attribute. See ParameterAttribute for details .
2437
+ :type param_attr: ParameterAttribute
2438
+ :param layer_attr: The extra layer attribute. See ExtraLayerAttribute for details .
2423
2439
:type layer_attr: ExtraLayerAttribute
2424
2440
:return: LayerOutput object.
2425
2441
:rtype: LayerOutput
@@ -4241,7 +4257,7 @@ def dot_prod_layer(input1, input2, name=None, layer_attr=None):
4241
4257
:param name: The name of this layer. It is optional.
4242
4258
:type name: basestring
4243
4259
:param input1: The first input layer.
4244
- :type input : LayerOutput
4260
+ :type input1 : LayerOutput
4245
4261
:param input2: The second input layer.
4246
4262
:type input2: LayerOutput
4247
4263
:param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
0 commit comments