code: def train_student(dataset, nb_teachers):
      """
      This function trains a student using predictions made by an ensemble of
      teachers. The student and teacher models are trained using the same
      neural network architecture.
      :param dataset: string corresponding to mnist, cifar10, or svhn
      :param nb_teachers: number of teachers (in the ensemble) to learn from
      :return: True if student training went well
      """
      assert input.create_dir_if_needed(FLAGS.train_dir)
  
      # Call helper function to prepare student data using teacher predictions
      stdnt_dataset = prepare_student_data(
          dataset, nb_teachers, save=True
      )
  
      # Unpack the student dataset
      (
          stdnt_data,
          stdnt_labels,
          stdnt_test_data,
          stdnt_test_labels,
      ) = stdnt_dataset
  
      # Prepare checkpoint filename and path
      if FLAGS.deeper:
          ckpt_path = (
              FLAGS.train_dir
              + "/"
              + str(dataset)
              + "_"
              + str(nb_teachers)
              + "_student_deeper.ckpt"
          )  # NOLINT(long-line)
      else:
          ckpt_path = (
              FLAGS.train_dir
              + "/"
              + str(dataset)
              + "_"
              + str(nb_teachers)
              + "_student.ckpt"
          )  # NOLINT(long-line)
  
      # Start student training
      assert deep_cnn.train(stdnt_data, stdnt_labels, ckpt_path)
  
      # Compute final checkpoint name for student (with max number of steps)
      ckpt_path_final = ckpt_path + "-" + str(FLAGS.max_steps - 1)
  
      # Compute student label predictions on remaining chunk of test set
      student_preds = deep_cnn.softmax_preds(
          stdnt_test_data, ckpt_path_final
      )
  
      # Compute teacher accuracy
      precision = metrics.accuracy(student_preds, stdnt_test_labels)
      print("Precision of student after training: " + str(precision))
  
      return True
  
file_path: privacy/research/pate_2017/train_student.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import aggregation
  import deep_cnn
  import input
  import metrics
  import numpy
  from six.moves import xrange
  import tensorflow.compat.v1
label_desc: Use image node_id 3 for calling a global function with example usage: train_student(dataset, nb_teachers) and returns: True