class_docstr: HiFiC Model class.
class_docstr_tok: ["HiFiC","Model","class","."]
docstr: Creates a train_op for the discriminator.
  
  Args:
    nodes: Instance of Nodes, the nodes of the model to feed to D.
    optimizer: Discriminator optimizer. Passed in because it will be re-used
      in the different discriminator steps.
    create_summaries: If True, create summaries.
  
  Returns:
    A training op if training, else no_op.
docstr_tok: ["Creates","a","train_op","for","the","discriminator",".","Args",":","nodes",":","Instance","of","Nodes",",","the","nodes","of","the","model","to","feed","to","D.","optimizer",":","Discriminator","optimizer",".","Passed","in","because","it","will","be","re-used","in","the","different","discriminator","steps",".","create_summaries",":","If","True",",","create","summaries",".","Returns",":","A","training","op","if","training",",","else","no_op","."]
code: def _train_discriminator(
      self, nodes: Nodes, optimizer, create_summaries
  ):
      """Creates a train_op for the discriminator.
  
      Args:
        nodes: Instance of Nodes, the nodes of the model to feed to D.
        optimizer: Discriminator optimizer. Passed in because it will be re-used
          in the different discriminator steps.
        create_summaries: If True, create summaries.
  
      Returns:
        A training op if training, else no_op.
      """
      d_out = self._compute_discriminator_out(
          nodes, create_summaries, gradients_to_generator=False
      )  # Only train discriminator!
      d_loss = self._create_gan_loss(
          d_out, create_summaries, mode="d_loss"
      )
  
      if not self.training:
          return tf.no_op()
  
      self._add_hook(tf.train.NanTensorHook(d_loss))
  
      # Getting the variables here because they don't exist before calling
      # _compute_discriminator_out for the first time!
      disc_vars = self._discriminator.trainable_variables
  
      update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
      with tf.control_dependencies(update_ops):
          with tf.name_scope("min_d"):
              train_op_d = optimizer.minimize(
                  d_loss, self._global_step_disc, disc_vars
              )
              return train_op_d
  
imports: import collections
  import glob
  import itertools
  from compare_gan.gans import loss_lib
  import tensorflow.compat.v1
  import tensorflow_datasets
  from hific import archs
  from hific import helpers
  from hific.helpers import ModelMode
  from hific.helpers import ModelType
  from hific.helpers import TFDSArguments
label_desc: Use image node_id 25 for calling the HiFiC obj's underlying member method code with example usage: obj._train_discriminator(nodes, optimizer, create_summaries) and returns: tf, train_op_d