W3cubDocs

/TensorFlow Python

tf.contrib.layers.instance_norm

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 has batch_size. The normalization is over all but the last dimension if data_format is NHWC and the second dimension if data_format is NCHW.
  • 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).
  • data_format: A string. NHWC (default) and NCHW are supported.
  • scope: Optional scope for variable_scope.

Returns:

A Tensor representing the output of the operation.

Raises:

  • ValueError: If data_format is neither NHWC nor NCHW.
  • ValueError: If the rank of inputs is undefined.
  • ValueError: If rank or channels dimension of inputs is undefined.

© 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/instance_norm