class_docstr: The optimizer class handles the gradient update stage of training a neural network.
  Given the current parameters :math:`w`, update parameters
  :math:`\Delta w`, and current state :math:`s`, the optimizer specifies an
  algorithm for performing the update.
  
  This base class contains to helper functions for scaling the gradients.
  specifices the abstract method optimize, which subclasses should implement. The optimize
  method is called at every minibatch to update the layer parameters.
class_docstr_tok: ["The","optimizer","class","handles","the","gradient","update","stage","of","training","a","neural","network",".","Given","the","current","parameters",":","math",":","`","w","`",",","update","parameters",":","math",":","`","\\Delta","w","`",",","and","current","state",":","math",":","`","s","`",",","the","optimizer","specifies","an","algorithm","for","performing","the","update",".","This","base","class","contains","to","helper","functions","for","scaling","the","gradients",".","specifices","the","abstract","method","optimize",",","which","subclasses","should","implement",".","The","optimize","method","is","called","at","every","minibatch","to","update","the","layer","parameters","."]
docstr: Returns a scaling factor to apply to the gradients.
  
  The scaling factor is computed such that the root mean squared
  average of the scaled gradients across all layers will be less than
  or equal to the provided clip_norm value. This factor is always <1, so
  never scales up the gradients.
  
  Arguments:
      param_list (list): List of layer parameters
      clip_norm (float, optional): Target norm for the gradients. If not provided
                                   the returned scale_factor will equal 1.
  
  Returns:
      scale_factor (float): Computed scale factor.
docstr_tok: ["Returns","a","scaling","factor","to","apply","to","the","gradients",".","The","scaling","factor","is","computed","such","that","the","root","mean","squared","average","of","the","scaled","gradients","across","all","layers","will","be","less","than","or","equal","to","the","provided","clip_norm","value",".","This","factor","is","always","<","1",",","so","never","scales","up","the","gradients",".","Arguments",":","param_list","(","list",")",":","List","of","layer","parameters","clip_norm","(","float",",","optional",")",":","Target","norm","for","the","gradients",".","If","not","provided","the","returned","scale_factor","will","equal","1",".","Returns",":","scale_factor","(","float",")",":","Computed","scale","factor","."]
code: def clip_gradient_norm(self, param_list, clip_norm):
      """
      Returns a scaling factor to apply to the gradients.
  
      The scaling factor is computed such that the root mean squared
      average of the scaled gradients across all layers will be less than
      or equal to the provided clip_norm value. This factor is always <1, so
      never scales up the gradients.
  
      Arguments:
          param_list (list): List of layer parameters
          clip_norm (float, optional): Target norm for the gradients. If not provided
                                       the returned scale_factor will equal 1.
  
      Returns:
          scale_factor (float): Computed scale factor.
      """
      scale_factor = 1
      if clip_norm:
          grad_list = [grad for (param, grad), states in param_list]
          grad_square_sums = sum(
              self.be.sum(self.be.square(grad)) for grad in grad_list
          )
          grad_norm = self.be.zeros((1, 1))
          grad_norm[:] = self.be.sqrt(grad_square_sums) / self.be.bsz
          scale_factor = clip_norm / max(
              float(grad_norm.get()), float(clip_norm)
          )
      return scale_factor
  
imports: from __future__ import division
  from neon import NervanaObject
  from neon.util.persist import load_class
  import logging
  import numpy
label_desc: Use image node_id 3 for calling the Optimizer obj's underlying member method code with example usage: obj.clip_gradient_norm(param_list, clip_norm) and returns: scale_factor