code: def build_graph(
      noise_shape, image_shape, G_progress_printer, D_progress_printer
  ):
      input_dynamic_axes = [C.Axis.default_batch_axis()]
      Z = C.input_variable(noise_shape, dynamic_axes=input_dynamic_axes)
      X_real = C.input_variable(
          image_shape, dynamic_axes=input_dynamic_axes
      )
      X_real_scaled = 2 * (X_real / 255.0) - 1.0
  
      # Create the model function for the generator and discriminator models
      X_fake = generator(Z)
      D_real = discriminator(X_real_scaled)
      D_fake = D_real.clone(
          method="share",
          substitutions={X_real_scaled.output: X_fake.output},
      )
  
      # Create loss functions and configure optimazation algorithms
      G_loss = 1.0 - C.log(D_fake)
      D_loss = -(C.log(D_real) + C.log(1.0 - D_fake))
  
      G_learner = C.fsadagrad(
          parameters=X_fake.parameters,
          lr=C.learning_parameter_schedule_per_sample(lr),
          momentum=C.momentum_schedule_per_sample(0.9985724484938566),
      )
      D_learner = C.fsadagrad(
          parameters=D_real.parameters,
          lr=C.learning_parameter_schedule_per_sample(lr),
          momentum=C.momentum_schedule_per_sample(0.9985724484938566),
      )
  
      DistG_learner = (
          C.train.distributed.data_parallel_distributed_learner(
              G_learner
          )
      )
  
      # The following API marks a learner as the matric aggregator, which is used by
      # the trainer to determine the training progress.
      # It is required, only when more than one learner is provided to a *single* trainer.
      # In this example, we use two trainers each with a single learner, so it
      # is not required and automatically set by CNTK for each single learner. However, if you
      # plan to use both learners with a single trainer, then it needs to be call before
      # creating the trainer.
      # DistG_learner.set_as_metric_aggregator()
  
      DistD_learner = (
          C.train.distributed.data_parallel_distributed_learner(
              D_learner
          )
      )
  
      # Instantiate the trainers
      G_trainer = C.Trainer(
          X_fake, (G_loss, None), DistG_learner, G_progress_printer
      )
      D_trainer = C.Trainer(
          D_real, (D_loss, None), DistD_learner, D_progress_printer
      )
  
      return X_real, X_fake, Z, G_trainer, D_trainer
  
file_path: CNTK/Examples/Image/GAN/Basic_GAN_Distributed.py
imports: import matplotlib
  import matplotlib.pyplot
  import numpy
  import os
  import argparse
  import cntk
  import cntk.tests.test_utils
  from timeit import default_timer
label_desc: Use image node_id 5 for calling a global function with example usage: build_graph(noise_shape, image_shape, G_progress_printer, D_progress_printer) and returns: X_real,  X_fake,  Z,  G_trainer,  D_trainer