MCPcopy Index your code
hub / github.com/tensorlayer/TensorLayer / BatchNorm

Class BatchNorm

tensorlayer/layers/normalization.py:149–308  ·  view source on GitHub ↗

The :class:`BatchNorm` is a batch normalization layer for both fully-connected and convolution outputs. See ``tf.nn.batch_normalization`` and ``tf.nn.moments``. Parameters ---------- decay : float A decay factor for `ExponentialMovingAverage`. Suggest to use a l

Source from the content-addressed store, hash-verified

147
148
149class BatchNorm(Layer):
150 """
151 The :class:`BatchNorm` is a batch normalization layer for both fully-connected and convolution outputs.
152 See ``tf.nn.batch_normalization`` and ``tf.nn.moments``.
153
154 Parameters
155 ----------
156 decay : float
157 A decay factor for `ExponentialMovingAverage`.
158 Suggest to use a large value for large dataset.
159 epsilon : float
160 Eplison.
161 act : activation function
162 The activation function of this layer.
163 is_train : boolean
164 Is being used for training or inference.
165 beta_init : initializer or None
166 The initializer for initializing beta, if None, skip beta.
167 Usually you should not skip beta unless you know what happened.
168 gamma_init : initializer or None
169 The initializer for initializing gamma, if None, skip gamma.
170 When the batch normalization layer is use instead of 'biases', or the next layer is linear, this can be
171 disabled since the scaling can be done by the next layer. see `Inception-ResNet-v2 <https://github.com/tensorflow/models/blob/master/research/slim/nets/inception_resnet_v2.py>`__
172 moving_mean_init : initializer or None
173 The initializer for initializing moving mean, if None, skip moving mean.
174 moving_var_init : initializer or None
175 The initializer for initializing moving var, if None, skip moving var.
176 num_features: int
177 Number of features for input tensor. Useful to build layer if using BatchNorm1d, BatchNorm2d or BatchNorm3d,
178 but should be left as None if using BatchNorm. Default None.
179 data_format : str
180 channels_last 'channel_last' (default) or channels_first.
181 name : None or str
182 A unique layer name.
183
184 Examples
185 ---------
186 With TensorLayer
187
188 >>> net = tl.layers.Input([None, 50, 50, 32], name='input')
189 >>> net = tl.layers.BatchNorm()(net)
190
191 Notes
192 -----
193 The :class:`BatchNorm` is universally suitable for 3D/4D/5D input in static model, but should not be used
194 in dynamic model where layer is built upon class initialization. So the argument 'num_features' should only be used
195 for subclasses :class:`BatchNorm1d`, :class:`BatchNorm2d` and :class:`BatchNorm3d`. All the three subclasses are
196 suitable under all kinds of conditions.
197
198 References
199 ----------
200 - `Source <https://github.com/ry/tensorflow-resnet/blob/master/resnet.py>`__
201 - `stackoverflow <http://stackoverflow.com/questions/38312668/how-does-one-do-inference-with-batch-normalization-with-tensor-flow>`__
202
203 """
204
205 def __init__(
206 self,

Callers 14

conv_blockFunction · 0.90
depthwise_conv_blockFunction · 0.90
make_layersFunction · 0.90
identity_blockFunction · 0.90
conv_blockFunction · 0.90
ResNet50Function · 0.90
get_model_batchnormFunction · 0.90
modelFunction · 0.90
modelFunction · 0.90
modelFunction · 0.90
setUpClassMethod · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by 4

setUpClassMethod · 0.68
__init__Method · 0.68
test_dataformatMethod · 0.68
test_exceptionMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…