import tensorflow as tf

      mdl = p.Instantiate()
      mdl.FPropDefaultTheta()
      var_grads = py_utils.ComputeGradients(mdl.loss, mdl.vars)
      summary_utils.CollectVarHistogram(var_grads)

  def testGradientMult(self):
    with self.session(use_gpu=False, graph=tf.Graph()):
      p = self._testParams()
      mdl = p.Instantiate()
      mdl.FPropDefaultTheta()
      var_grads = py_utils.ComputeGradients(mdl.loss, mdl.vars)
      py_utils.ApplyGradMultiplier(var_grads, -1.1)

  def testLRDecay(self):
    with self.session(use_gpu=False, graph=tf.Graph()) as sess:
      p = self._testParams()
      tp = p.train
      tp.lr_schedule.boundaries = [300000, 400000, 500000]
      tp.lr_schedule.values = [1.0, 0.1, 0.01, 0.001]
      lrs = tp.lr_schedule.Instantiate()
      steps = [299999, 300001, 399999, 400001, 499999, 500001]
      fetches = [lrs.Value(_) for _ in steps]
      values = sess.run(fetches)
      self.assertAllClose([1.0, 0.1, 0.1, 0.01, 0.01, 0.001], values)

  def testBatchSplit(self):

    def Run(num_splits):
