def __init__(self, data_format=None, offset=True, scale=False,
               decay_rate=0.999, eps=1e-3, initializers=None,
               partitioners=None, regularizers=None,
               update_ops_collection=None, fused=True,
               name="batch_norm"):
    """Constructs a BatchNormV2 module.

    Reduces over all input tensor dimensions apart from the channel
    dimension. This has the effect of treating pixels in 1D/2D/3D images as
    additional elements of the minibatch.

    Args:
      data_format: The data format. Can be "NC", "NWC", "NCW", "NHWC", "NCHW",
        "NDHWC", or "NCDHW". If not provided we assume the channel dimension is
        last.
      offset: Optional boolean to specify whether or not to apply a trained
        component-wise bias after the batch normalization and scaling.
      scale: Optional boolean to specify whether or not to apply a trained
        component-wise scale after the batch normalization.
      decay_rate: Decay rate of the exponential moving averages of the mean
        and variance.
      eps: Small number to avoid dividing by zero when diving by the standard
        deviation.
      initializers: Optional dict containing ops to initialize the weights of
        the affine transform (`gamma` and `beta`).
      partitioners: Optional dict containing partitioners to partition the
        weights of the affine transform (`gamma` and `beta`).
      regularizers: Optional dict containing regularizers for the weights of the
        affine transform ("gamma" and "beta"). As a default, no regularizers are
        used. A regularizer should be a function that takes a single `Tensor` as
        an input and returns a scalar `Tensor` output, e.g. the L1 and L2
        regularizers in `tf.contrib.layers`.
      update_ops_collection: Optional name of TensorFlow variable collection to
        add the moving average update ops to. If not provided, we instead add
        the update ops as control dependencies of the output of the module. This
        may result in some slowdown, as the feed-forward of the network is now
        blocked.
      fused: Use nn.fused_batch_norm if True, nn.batch_normalization otherwise.
      name: Name of the module.

    Raises:
      KeyError: If `initializers` contains any keys other than `gamma`, `beta`,
        `moving_mean` or `moving_variance`.
      KeyError: If `partitioners` or `regularizers` contains any keys other
        than `gamma` or `beta`.
      TypeError: If any of the given initializers, partitioners or regularizers
        are not callable.
      ValueError: If `data_format` is invalid.
    """
    super(BatchNormV2, self).__init__(name=name)

    if data_format not in self.SUPPORTED_DATA_FORMATS.union({None}):
      raise ValueError("Invalid data_format: %r" % (data_format,))

    self._data_format = data_format
    self._offset = offset
    self._scale = scale
    self._decay_rate = decay_rate
    self._eps = eps
    self._update_ops_collection = update_ops_collection
    self._fused = fused

    self._initializers = util.check_initializers(
        initializers, self.POSSIBLE_INITIALIZER_KEYS)
    self._partitioners = util.check_partitioners(
        partitioners, self.POSSIBLE_PARTITIONER_KEYS)
    self._regularizers = util.check_regularizers(
        regularizers, self.POSSIBLE_REGULARIZER_KEYS)
def __init__ ( self , data_format = None , offset = True , scale = False , decay_rate = 0.999 , eps = 1e-3 , initializers = None , partitioners = None , regularizers = None , update_ops_collection = None , fused = True , name = "batch_norm" ) : super ( BatchNormV2 , self ) . __init__ ( name = name ) if data_format not in self . SUPPORTED_DATA_FORMATS . union ( { None } ) : raise ValueError ( "Invalid data_format: %r" % ( data_format , ) ) self . _data_format = data_format self . _offset = offset self . _scale = scale self . _decay_rate = decay_rate self . _eps = eps self . _update_ops_collection = update_ops_collection self . _fused = fused self . _initializers = util . check_initializers ( initializers , self . POSSIBLE_INITIALIZER_KEYS ) self . _partitioners = util . check_partitioners ( partitioners , self . POSSIBLE_PARTITIONER_KEYS ) self . _regularizers = util . check_regularizers ( regularizers , self . POSSIBLE_REGULARIZER_KEYS )
Constructs a BatchNormV2 module.

    Reduces over all input tensor dimensions apart from the channel
    dimension. This has the effect of treating pixels in 1D/2D/3D images as
    additional elements of the minibatch.

    Args:
      data_format: The data format. Can be "NC", "NWC", "NCW", "NHWC", "NCHW",
        "NDHWC", or "NCDHW". If not provided we assume the channel dimension is
        last.
      offset: Optional boolean to specify whether or not to apply a trained
        component-wise bias after the batch normalization and scaling.
      scale: Optional boolean to specify whether or not to apply a trained
        component-wise scale after the batch normalization.
      decay_rate: Decay rate of the exponential moving averages of the mean
        and variance.
      eps: Small number to avoid dividing by zero when diving by the standard
        deviation.
      initializers: Optional dict containing ops to initialize the weights of
        the affine transform (`gamma` and `beta`).
      partitioners: Optional dict containing partitioners to partition the
        weights of the affine transform (`gamma` and `beta`).
      regularizers: Optional dict containing regularizers for the weights of the
        affine transform ("gamma" and "beta"). As a default, no regularizers are
        used. A regularizer should be a function that takes a single `Tensor` as
        an input and returns a scalar `Tensor` output, e.g. the L1 and L2
        regularizers in `tf.contrib.layers`.
      update_ops_collection: Optional name of TensorFlow variable collection to
        add the moving average update ops to. If not provided, we instead add
        the update ops as control dependencies of the output of the module. This
        may result in some slowdown, as the feed-forward of the network is now
        blocked.
      fused: Use nn.fused_batch_norm if True, nn.batch_normalization otherwise.
      name: Name of the module.

    Raises:
      KeyError: If `initializers` contains any keys other than `gamma`, `beta`,
        `moving_mean` or `moving_variance`.
      KeyError: If `partitioners` or `regularizers` contains any keys other
        than `gamma` or `beta`.
      TypeError: If any of the given initializers, partitioners or regularizers
        are not callable.
      ValueError: If `data_format` is invalid.