tf.contrib.layers.group_norm( inputs, groups=32, channels_axis=-1, reduction_axes=(-3, -2), center=True, scale=True, epsilon=1e-06, activation_fn=None, param_initializers=None, reuse=None, variables_collections=None, outputs_collections=None, trainable=True, scope=None )
Defined in tensorflow/contrib/layers/python/layers/normalization.py
.
Functional interface for the group normalization layer.
Reference: https://arxiv.org/abs/1803.08494.
"Group Normalization", Yuxin Wu, Kaiming He
inputs
: A Tensor with at least 2 dimensions one which is channels. All shape dimensions must be fully defined.groups
: Integer. Divide the channels into this number of groups over which normalization statistics are computed. This number must be commensurate with the number of channels in inputs
.channels_axis
: An integer. Specifies index of channels axis which will be broken into groups
, each of which whose statistics will be computed across. Must be mutually exclusive with reduction_axes
. Preferred usage is to specify negative integers to be agnostic as to whether a batch dimension is included.reduction_axes
: Tuple of integers. Specifies dimensions over which statistics will be accumulated. Must be mutually exclusive with channels_axis
. Statistics will not be accumulated across axes not specified in reduction_axes
nor channel_axis
. Preferred usage is to specify negative integers to be agnostic to whether a batch dimension is included.
Some sample usage cases: NHWC format: channels_axis=-1, reduction_axes=[-3, -2] NCHW format: channels_axis=-3, reduction_axes=[-2, -1]
center
: If True, add offset of beta
to normalized tensor. If False, beta
is ignored.
scale
: If True, multiply by gamma
. If False, gamma
is not used. When the next layer is linear (also e.g. nn.relu
), this can be disabled since the scaling can be done by the next layer.epsilon
: Small float added to variance to avoid dividing by zero.activation_fn
: Activation function, default set to None to skip it and maintain a linear activation.param_initializers
: Optional initializers for beta, gamma, moving mean and moving variance.reuse
: Whether or not the layer and its variables should be reused. To be able to reuse the layer scope must be given.variables_collections
: Optional collections for the variables.outputs_collections
: Collections to add the outputs.trainable
: If True
also add variables to the graph collection GraphKeys.TRAINABLE_VARIABLES
(see tf.Variable
).scope
: Optional scope for variable_scope
.A Tensor
representing the output of the operation.
ValueError
: If the rank of inputs
is undefined.ValueError
: If rank or channels dimension of inputs
is undefined.ValueError
: If number of groups is not commensurate with number of channels.ValueError
: If reduction_axes or channels_axis are out of bounds.ValueError
: If reduction_axes are not mutually exclusive with channels_axis.
© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/layers/group_norm