code: def get_target_indices(logits, labels, adv_target_config):
      """Selects targeting classes for adversarial attack (classification only).
  
      Args:
        logits: tensor of shape `[batch_size, num_classes]` and dtype=`tf.float32`.
        labels: `int` tensor with a shape of `[batch_size]` containing the ground
          truth labels.
        adv_target_config: instance of `nsl.configs.AdvTargetConfig` specifying the
          adversarial target configuration.
  
      Returns:
        Tensor of shape `[batch_size]` and dtype=`tf.int32` of indices of targets.
      """
      num_classes = tf.shape(input=logits)[-1]
      if (
          adv_target_config.target_method
          == configs.AdvTargetType.SECOND
      ):
          _, top2_indices = tf.nn.top_k(logits, k=2)
          indices = tf.reshape(top2_indices[:, 1], [-1])
      elif (
          adv_target_config.target_method == configs.AdvTargetType.LEAST
      ):
          indices = tf.argmin(
              input=logits, axis=-1, output_type=tf.dtypes.int32
          )
      elif (
          adv_target_config.target_method
          == configs.AdvTargetType.RANDOM
      ):
          batch_size = tf.shape(input=logits)[0]
          indices = tf.random.uniform(
              [batch_size],
              maxval=num_classes,
              dtype=tf.dtypes.int32,
              seed=adv_target_config.random_seed,
          )
      elif (
          adv_target_config.target_method
          == configs.AdvTargetType.GROUND_TRUTH
      ):
          indices = labels
      else:
          raise NotImplementedError(
              'Unrecognized or unimplemented "target_method"'
          )
      return indices
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import neural_structured_learning.configs
  import six
  import tensorflow
label_desc: Use image node_id 7 for calling a global function with example usage: get_target_indices(logits, labels, adv_target_config) and returns: indices