code: def test_learner_update():
      i = C.input_variable(shape=(1,), needs_gradient=True, name="a")
      w_init = 1
      w = parameter(shape=(1,), init=w_init)
      res = i * w
  
      learner = sgd(
          res.parameters,
          lr=C.learning_parameter_schedule(
              [0.1] * 50 + [0.2] * 50, minibatch_size=1, epoch_size=1
          ),
      )
      assert learner.learning_rate() == 0.1
      x = learner.update(
          {w: np.asarray([[2.0]], dtype=np.float32)}, 100
      )
      assert learner.learning_rate() == 0.2
      assert w.value < w_init
  
      learner.reset_learning_rate(
          learning_parameter_schedule(
              [0.3] * 50 + [0.4] * 50, minibatch_size=1, epoch_size=1
          )
      )
      assert learner.learning_rate() == 0.3
      x = learner.update(
          {w: np.asarray([[2.0]], dtype=np.float32)}, 100
      )
      assert learner.learning_rate() == 0.4
  
imports: from __future__ import division, print_function
  import numpy
  import cntk
  from cntk import parameter
  import pytest
  import sys
  import itertools
  from cntk.logging import ProgressPrinter
  from cntk.learners import sgd, learning_rate_schedule, learning_parameter_schedule, UnitType, universal
  from cntk.layers import Dense, Sequential
label_desc: Use image node_id 9 for calling a global function with example usage: test_learner_update() without return types