Skip to content

Commit 3b3b116

Browse files
committed
update LRN layer
1 parent 892b085 commit 3b3b116

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tensorlayer/layers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,7 +2153,7 @@ def _PS(X, r, n_out_channel):
21532153

21542154
# ## Normalization layer
21552155
class LocalResponseNormLayer(Layer):
2156-
"""The :class:`LocalResponseNormLayer` class is for Local Response Normalization, see ``tf.nn.local_response_normalization``.
2156+
"""The :class:`LocalResponseNormLayer` class is for Local Response Normalization, see ``tf.nn.local_response_normalization`` or ``tf.nn.lrn`` for new TF version.
21572157
The 4-D input tensor is treated as a 3-D array of 1-D vectors (along the last dimension), and each vector is normalized independently.
21582158
Within a given vector, each component is divided by the weighted, squared sum of inputs within depth_radius.
21592159
@@ -2175,11 +2175,12 @@ def __init__(
21752175
beta = None,
21762176
name ='lrn_layer',
21772177
):
2178+
Layer.__init__(self, name=name)
21782179
self.inputs = layer.outputs
21792180
print(" [TL] LocalResponseNormLayer %s: depth_radius: %d, bias: %f, alpha: %f, beta: %f" %
21802181
(self.name, depth_radius, bias, alpha, beta))
21812182
with tf.variable_scope(name) as vs:
2182-
self.outputs = tf.nn.local_response_normalization(self.inputs, depth_radius=depth_radius, bias=bias, alpha=alpha, beta=beta)
2183+
self.outputs = tf.nn.lrn(self.inputs, depth_radius=depth_radius, bias=bias, alpha=alpha, beta=beta)
21832184

21842185
self.all_layers = list(layer.all_layers)
21852186
self.all_params = list(layer.all_params)

0 commit comments

Comments
 (0)