code: def create_trainer(
      network,
      epoch_size,
      num_quantization_bits,
      printer,
      block_size,
      warm_up,
      minibatch_size,
  ):
      # Set learning parameters
      lr_per_mb = (
          [0.01] * 25
          + [0.001] * 25
          + [0.0001] * 25
          + [0.00001] * 25
          + [0.000001]
      )
      lr_schedule = C.learning_parameter_schedule(
          lr_per_mb,
          minibatch_size=minibatch_size,
          epoch_size=epoch_size,
      )
      mm_schedule = C.learners.momentum_schedule(
          0.9, minibatch_size=minibatch_size
      )
      l2_reg_weight = 0.0005  # CNTK L2 regularization is per sample, thus same as Caffe
  
      if block_size != None and num_quantization_bits != 32:
          raise RuntimeError(
              "Block momentum cannot be used with quantization, please remove quantized_bits option."
          )
  
      # Create learner
      local_learner = C.learners.momentum_sgd(
          network["output"].parameters,
          lr_schedule,
          mm_schedule,
          minibatch_size=minibatch_size,
          unit_gain=False,
          l2_regularization_weight=l2_reg_weight,
      )
      # Since we reuse parameter settings (learning rate, momentum) from Caffe, we set unit_gain to False to ensure consistency
  
      # Create trainer
      if block_size != None:
          parameter_learner = block_momentum_distributed_learner(
              local_learner, block_size=block_size
          )
      else:
          parameter_learner = data_parallel_distributed_learner(
              local_learner,
              num_quantization_bits=num_quantization_bits,
              distributed_after=warm_up,
          )
  
      return C.Trainer(
          network["output"],
          (network["ce"], network["pe"]),
          parameter_learner,
          printer,
      )
  
imports: from __future__ import print_function
  import os
  import math
  import argparse
  import numpy
  import cntk
  import _cntk_py
  from cntk.logging import *
  from cntk.train.training_session import *
  from cntk import *
  from cntk.train.distributed import *
  from cntk.io import ImageDeserializer, MinibatchSource, StreamDef, StreamDefs, FULL_DATA_SWEEP
  import cntk.io.transforms
  from cntk.layers import Convolution2D, Activation, MaxPooling, Dense, Dropout, default_options, Sequential
  from cntk.initializer import normal
label_desc: Use image node_id 4 for calling a global function with example usage: create_trainer(network, epoch_size, num_quantization_bits, printer, block_size, warm_up, minibatch_size) and returns: C