code: def default_optimization_hparams():
      """Returns a `dict` of default hyperparameters of training op
      and their default values
  
      .. role:: python(code)
         :language: python
  
      .. code-block:: python
  
          {
              "optimizer": {
                  "type": "AdamOptimizer",
                  "kwargs": {
                      "learning_rate": 0.001
                  }
              },
              "learning_rate_decay": {
                  "type": "",
                  "kwargs": {},
                  "min_learning_rate": 0.,
                  "start_decay_step": 0,
                  "end_decay_step": inf
              },
              "gradient_clip": {
                  "type": "",
                  "kwargs": {}
              },
              "gradient_noise_scale": None,
              "name": None
          }
  
      Here:
  
      "optimizer": dict
          Hyperparameters of a :tf_main:`tf.train.Optimizer <train/Optimizer>`.
  
          - **"type"** specifies the optimizer class. This can be
  
              - The string name or full module path of an optimizer class. \
              If the class name is provided, the class must be in module \
              :tf_main:`tf.train <train>`, \
              :tf_main:`tf.contrib.opt <contrib/opt>` or :mod:`texar.tf.custom` \
              , :mod:`texar.tf.core.optimization`
              - An optimizer class.
              - An instance of an optimizer class.
  
              For example
  
              .. code-block:: python
  
                  "type": "AdamOptimizer" # class name
                  "type": "my_module.MyOptimizer" # module path
                  "type": tf.contrib.opt.AdamWOptimizer # class
                  "type": my_module.MyOptimizer # class
                  "type": GradientDescentOptimizer(learning_rate=0.1) # instance
                  "type": MyOptimizer(...) # instance
  
          - **"kwargs"** is a `dict` specifying keyword arguments for creating \
          the optimizer class instance, with :python:`opt_class(**kwargs)`. \
          Ignored if "type" is a class instance.
  
      "learning_rate_decay": dict
          Hyperparameters of learning rate decay function. The learning rate
          starts decay from :attr:`"start_decay_step"` and keeps unchanged after
          :attr:`"end_decay_step"` or reaching :attr:`"min_learning_rate"`.
  
          The decay function is specified in "type" and "kwargs".
  
              - "type" can be a decay function or its name or module path. If \
              function name is provided, it must be from module \
              :tf_main:`tf.train <train>` or :mod:`texar.tf.custom`, \
              :mod:`texar.tf.core.optimization`.
  
              - "kwargs" is a `dict` of keyword arguments for the function \
              excluding arguments named "global_step" and "learning_rate".
  
          The function is called with
          :python:`lr = decay_fn(learning_rate=lr, global_step=offset_step,
          **kwargs)`, where `offset_step` is the global step offset as above.
          The only exception is :tf_main:`tf.train.piecewise_constant
          <train/piecewise_constant>` which is called with
          :python:`lr = piecewise_constant(x=offset_step, **kwargs)`.
  
      "gradient_clip": dict
          Hyperparameters of gradient clipping. The gradient clipping function
          takes a list of `(gradients, variables)` tuples and returns a list
          of `(clipped_gradients, variables)` tuples. Typical examples include
          :tf_main:`tf.clip_by_global_norm <clip_by_global_norm>`,
          :tf_main:`tf.clip_by_value <clip_by_value>`,
          :tf_main:`tf.clip_by_norm <clip_by_norm>`,
          :tf_main:`tf.clip_by_average_norm <clip_by_average_norm>`, etc.
  
          "type" specifies the gradient clip function, and can be a function,
          or its name or mudule path. If function name is provided, the
          function must be from module :tf_main:`tf < >`
          or :mod:`texar.tf.custom`, :mod:`texar.tf.core.optimization`.
  
  
          "kwargs" specifies keyword arguments to the function, except arguments
          named "t" or "t_list".
  
          The function is called with
          :python:`clipped_grads(, _) = clip_fn(t_list=grads, **kwargs)`
          (e.g., for :tf_main:`tf.clip_by_global_norm <clip_by_global_norm>`) or
          :python:`clipped_grads = [clip_fn(t=grad, **kwargs) for grad in grads]`
          (e.g., for :tf_main:`tf.clip_by_value <clip_by_value>`).
  
      "gradient_noise_scale": float, optional
          Adds 0-mean normal noise scaled by this value to gradient.
      """
      return {
          "optimizer": {
              "type": "AdamOptimizer",
              "kwargs": {"learning_rate": 0.001},
          },
          "learning_rate_decay": {
              "type": "",
              "kwargs": {},
              "min_learning_rate": 0.0,
              "start_decay_step": 0,
              "end_decay_step": utils.MAX_SEQ_LENGTH,
          },
          "gradient_clip": {"type": "", "kwargs": {}},
          "gradient_noise_scale": None,
          # TODO(zhiting): allow module-level control of gradient_multipliers
          "name": None,
      }
  
file_path: texar/texar/tf/core/optimization.py
imports: import re
  import tensorflow
  from texar.tf.hyperparams import HParams
  from texar.tf.utils import utils
label_desc: Use image node_id 1 for calling a global function with example usage: default_optimization_hparams() and returns: dict