docstr: The MomentumSGDUpdate op implements the update V as
  
      V := mu * V + lr * grad,
  
  where mu is the momentum factor, lr is the learning rate, and grad is
  the stochastic gradient. Since V is not defined independently of the
  learning rate (as it should ideally be), when the learning rate is
  changed we should scale the update history V in order to make it
  compatible in scale with lr * grad.
docstr_tok: ["The","MomentumSGDUpdate","op","implements","the","update","V","as","V",":","=","mu","*","V","+","lr","*","grad",",","where","mu","is","the","momentum","factor",",","lr","is","the","learning","rate",",","and","grad","is","the","stochastic","gradient",".","Since","V","is","not","defined","independently","of","the","learning","rate","(","as","it","should","ideally","be",")",",","when","the","learning","rate","is","changed","we","should","scale","the","update","history","V","in","order","to","make","it","compatible","in","scale","with","lr","*","grad","."]
code: def _CorrectMomentum(self, correction):
      """The MomentumSGDUpdate op implements the update V as
  
          V := mu * V + lr * grad,
  
      where mu is the momentum factor, lr is the learning rate, and grad is
      the stochastic gradient. Since V is not defined independently of the
      learning rate (as it should ideally be), when the learning rate is
      changed we should scale the update history V in order to make it
      compatible in scale with lr * grad.
      """
      logger.info(
          "Scaling update history by {:.6f} (new lr / old lr)".format(
              correction
          )
      )
      for i in range(cfg.NUM_GPUS):
          with c2_utils.CudaScope(i):
              for param in self.TrainableParams(gpu_id=i):
                  op = core.CreateOperator(
                      "Scale",
                      [param + "_momentum"],
                      [param + "_momentum"],
                      scale=correction,
                  )
                  workspace.RunOperatorOnce(op)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import numpy
  import logging
  from caffe2.python import cnn
  from caffe2.python import core
  from caffe2.python import workspace
  from caffe2.python.modeling import initializers
  from caffe2.python.modeling.parameter_info import ParameterTags
  from detectron.core.config import cfg
  from detectron.ops.collect_and_distribute_fpn_rpn_proposals import CollectAndDistributeFpnRpnProposalsOp
  from detectron.ops.generate_proposal_labels import GenerateProposalLabelsOp
  from detectron.ops.generate_proposals import GenerateProposalsOp
  import detectron.roi_data.fast_rcnn
  import detectron.utils.c2
label_desc: Use image node_id 17 for calling the DetectionModelHelper obj's underlying member method code with example usage: obj._CorrectMomentum(correction) without return types