class_docstr: This class implements a classifier with the TensorFlow framework.
class_docstr_tok: ["This","class","implements","a","classifier","with","the","TensorFlow","framework","."]
code: def _init_class_grads(self, label=None):
      # pylint: disable=E0401
      import tensorflow.compat.v1 as tf
  
      if not hasattr(self, "_class_grads"):
          self._class_grads = [None for _ in range(self.nb_classes)]
  
      # Construct the class gradients graph
      if label is None:
          if None in self._class_grads:
              self._class_grads = [
                  tf.gradients(self.output[:, i], self.input_ph)[0]
                  for i in range(self.nb_classes)
              ]
  
      elif isinstance(label, int):
          if self._class_grads[label] is None:
              self._class_grads[label] = tf.gradients(
                  self.output[:, label], self.input_ph
              )[0]
  
      else:
          for unique_label in np.unique(label):
              if self._class_grads[unique_label] is None:
                  self._class_grads[unique_label] = tf.gradients(
                      self.output[:, unique_label], self.input_ph
                  )[0]
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import os
  import random
  import shutil
  import time
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union, TYPE_CHECKING
  from tqdm.auto import tqdm
  import numpy
  import six
  from art import config
  from art.estimators.classification.classifier import ClassGradientsMixin, ClassifierMixin
  from art.estimators.tensorflow import TensorFlowEstimator, TensorFlowV2Estimator
  from art.utils import check_and_transform_label_format
label_desc: Use image node_id 17 for calling the TensorFlowClassifier obj's underlying member method code with example usage: obj._init_class_grads(label) without return types