class_docstr: Keras' layer implementation for DynamicNormalization.
  
  Similar to Batch Normalization, DynamicNormalization normalizes the
  activations of the previous layer for each input.
  
  The normalization formula:
    ((|mean|^2 + p(mean)) / |x|^2 - 2 * g(mean)) / sqrt(variance)
  where
    p(mean) = prior_scale * mean + prior_offset
    g(mean) = mean_scale * mean + mean_offset.
  Here (prior_scale, prior_offset, mean_scale, mean_offset) are learnable
  parameters.
docstr: Constructor of DynamicNormalization.
  
  Args:
    dm_config: An instance of DynamicEmbeddingConfig.
    mode: An int or a `Tensor` whose value must be  one of
      {LOOKUP_WITHOUT_UPDATE, LOOKUP_WITH_UPDATE, LOOKUP_WITH_GROW} as defined
      in dynamic_memory_ops.py.
    axis: Integer, the axis along which to compute mean and variance.
    epsilon: Small float added to variance to avoid dividing by zero.
    scale_initializer: Initializer for the scale weight.
    offset_initializer: Initializer for the offset weight.
    scale_regularizer: Optional regularizer for the scale weight.
    offset_regularizer: Optional regularizer for the offset weight.
    scale_constraint: Optional constraint for the scale weight.
    offset_constraint: Optional constraint for the offset weight.
    use_batch_normalization: Boolean, if `True`, use BatchNormalization's
      formula instead of DynamicNormalization's own one when computing the
      output.
    trainable: Boolean, if `True` the variables will be marked as trainable.
    service_address: The address of a knowledge bank service. If empty, the
      value passed from --kbs_address flag will be used instead.
    name: A string indicating the op's name.
    **kwargs: Addition inputs.
docstr_tok: ["Constructor","of","DynamicNormalization",".","Args",":","dm_config",":","An","instance","of","DynamicEmbeddingConfig",".","mode",":","An","int","or","a","`","Tensor","`","whose","value","must","be","one","of","{","LOOKUP_WITHOUT_UPDATE",",","LOOKUP_WITH_UPDATE",",","LOOKUP_WITH_GROW","}","as","defined","in","dynamic_memory_ops.py",".","axis",":","Integer",",","the","axis","along","which","to","compute","mean","and","variance",".","epsilon",":","Small","float","added","to","variance","to","avoid","dividing","by","zero",".","scale_initializer",":","Initializer","for","the","scale","weight",".","offset_initializer",":","Initializer","for","the","offset","weight",".","scale_regularizer",":","Optional","regularizer","for","the","scale","weight",".","offset_regularizer",":","Optional","regularizer","for","the","offset","weight",".","scale_constraint",":","Optional","constraint","for","the","scale","weight",".","offset_constraint",":","Optional","constraint","for","the","offset","weight",".","use_batch_normalization",":","Boolean",",","if","`","True","`",",","use","BatchNormalization's","formula","instead","of","DynamicNormalization","'s","own","one","when","computing","the","output",".","trainable",":","Boolean",",","if","`","True","`","the","variables","will","be","marked","as","trainable",".","service_address",":","The","address","of","a","knowledge","bank","service",".","If","empty",",","the","value","passed","from","--","kbs_address","flag","will","be","used","instead",".","name",":","A","string","indicating","the","op","'s","name",".","*","*","kwargs",":","Addition","inputs","."]
code: def __init__(
      self,
      dm_config: de_config_pb2.DynamicEmbeddingConfig,
      mode: int,
      axis: int = -1,
      epsilon: float = 1e-3,
      scale_initializer="ones",
      offset_initializer="zeros",
      scale_regularizer=None,
      offset_regularizer=None,
      scale_constraint=None,
      offset_constraint=None,
      use_batch_normalization: bool = False,
      trainable=True,
      service_address: typing.Text = "",
      name=None,
      **kwargs,
  ):
      r"""Constructor of DynamicNormalization.
  
      Args:
        dm_config: An instance of DynamicEmbeddingConfig.
        mode: An int or a `Tensor` whose value must be  one of
          {LOOKUP_WITHOUT_UPDATE, LOOKUP_WITH_UPDATE, LOOKUP_WITH_GROW} as defined
          in dynamic_memory_ops.py.
        axis: Integer, the axis along which to compute mean and variance.
        epsilon: Small float added to variance to avoid dividing by zero.
        scale_initializer: Initializer for the scale weight.
        offset_initializer: Initializer for the offset weight.
        scale_regularizer: Optional regularizer for the scale weight.
        offset_regularizer: Optional regularizer for the offset weight.
        scale_constraint: Optional constraint for the scale weight.
        offset_constraint: Optional constraint for the offset weight.
        use_batch_normalization: Boolean, if `True`, use BatchNormalization's
          formula instead of DynamicNormalization's own one when computing the
          output.
        trainable: Boolean, if `True` the variables will be marked as trainable.
        service_address: The address of a knowledge bank service. If empty, the
          value passed from --kbs_address flag will be used instead.
        name: A string indicating the op's name.
        **kwargs: Addition inputs.
      """
      super(DynamicNormalization, self).__init__(name=name, **kwargs)
      if mode is None:
          raise ValueError("Must specify model mode.")
  
      self.axis = axis
      self.dm_config = dm_config
      self.mode = mode
      self.epsilon = epsilon
      self.scale_initializer = tf.keras.initializers.get(
          scale_initializer
      )
      self.offset_initializer = tf.keras.initializers.get(
          offset_initializer
      )
      self.scale_regularizer = tf.keras.regularizers.get(
          scale_regularizer
      )
      self.offset_regularizer = tf.keras.regularizers.get(
          offset_regularizer
      )
      self.scale_constraint = tf.keras.constraints.get(scale_constraint)
      self.offset_constraint = tf.keras.constraints.get(
          offset_constraint
      )
      self.use_batch_normalization = use_batch_normalization
      self.trainable = trainable
      self.service_address = service_address
  
file_path: neural-structured-learning/research/carls/dynamic_normalization.py
imports: import typing
  from research.carls import dynamic_embedding_config_pb2
  from research.carls import dynamic_memory_ops
  import tensorflow
label_desc: Use image node_id 1 to create a new DynamicNormalization object from inherited base classes: tf.keras.layers with example: obj = DynamicNormalization(dm_config, mode, axis, epsilon, scale_initializer, offset_initializer, scale_regularizer, offset_regularizer, scale_constraint, offset_constraint, use_batch_normalization, trainable, service_address, name)