tf.contrib.layers.instance_norm(
inputs,
center=True,
scale=True,
epsilon=1e-06,
activation_fn=None,
param_initializers=None,
reuse=None,
variables_collections=None,
outputs_collections=None,
trainable=True,
data_format=DATA_FORMAT_NHWC,
scope=None
)
Defined in tensorflow/contrib/layers/python/layers/normalization.py
.
Functional interface for the instance normalization layer.
Reference: https://arxiv.org/abs/1607.08022.
"Instance Normalization: The Missing Ingredient for Fast Stylization" Dmitry Ulyanov, Andrea Vedaldi, Victor Lempitsky
Args:
inputs
: A tensor with 2 or more dimensions, where the first dimension hasbatch_size
. The normalization is over all but the last dimension ifdata_format
isNHWC
and the second dimension ifdata_format
isNCHW
.center
: If True, add offset ofbeta
to normalized tensor. If False,beta
is ignored.scale
: If True, multiply bygamma
. 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
: IfTrue
also add variables to the graph collectionGraphKeys.TRAINABLE_VARIABLES
(seetf.Variable
).data_format
: A string.NHWC
(default) andNCHW
are supported.scope
: Optional scope forvariable_scope
.
Returns:
A Tensor
representing the output of the operation.
Raises:
ValueError
: Ifdata_format
is neitherNHWC
norNCHW
.ValueError
: If the rank ofinputs
is undefined.ValueError
: If rank or channels dimension ofinputs
is undefined.