code: def ffnet():
      input_dim = 2
      num_output_classes = 2
      num_hidden_layers = 2
      hidden_layers_dim = 50
  
      # Input variables denoting the features and label data
      feature = input_variable((input_dim), np.float32)
      label = input_variable((num_output_classes), np.float32)
  
      netout = Sequential(
          [
              For(
                  range(num_hidden_layers),
                  lambda i: Dense(
                      hidden_layers_dim, activation=sigmoid
                  ),
              ),
              Dense(num_output_classes),
          ]
      )(feature)
  
      ce = cross_entropy_with_softmax(netout, label)
      pe = classification_error(netout, label)
  
      lr_per_minibatch = learning_parameter_schedule(0.5)
      # Instantiate the trainer object to drive the model training
      learner = sgd(netout.parameters, lr=lr_per_minibatch)
      progress_printer = ProgressPrinter(128)
      trainer = Trainer(netout, (ce, pe), learner, progress_printer)
  
      # Get minibatches of training data and perform model training
      minibatch_size = 25
  
      for i in range(1024):
          features, labels = generate_random_data(
              minibatch_size, input_dim, num_output_classes
          )
          # Specify the mapping of input variables in the model to actual
          # minibatch data to be trained with
          trainer.train_minibatch({feature: features, label: labels})
  
      trainer.summarize_training_progress()
      test_features, test_labels = generate_random_data(
          minibatch_size, input_dim, num_output_classes
      )
      avg_error = trainer.test_minibatch(
          {feature: test_features, label: test_labels}
      )
      return avg_error
  
file_path: CNTK/Tutorials/NumpyInterop/FeedForwardNet.py
imports: import numpy
  from cntk.device import cpu, try_set_default_device
  from cntk import Trainer
  from cntk.layers import Dense, Sequential, For
  from cntk.learners import sgd, learning_parameter_schedule
  from cntk.ops import input_variable, sigmoid
  from cntk.losses import cross_entropy_with_softmax
  from cntk.metrics import classification_error
  from cntk.logging import ProgressPrinter
label_desc: Use image node_id 2 for calling a global function with example usage: ffnet() and returns: avg_error