class_docstr: This class implements a classifier with the TensorFlow v2 framework.
class_docstr_tok: ["This","class","implements","a","classifier","with","the","TensorFlow","v2","framework","."]
docstr: Resets the weights of the classifier so that it can be refit from scratch.
docstr_tok: ["Resets","the","weights","of","the","classifier","so","that","it","can","be","refit","from","scratch","."]
code: def reset(self) -> None:
      """
      Resets the weights of the classifier so that it can be refit from scratch.
      """
      import tensorflow as tf
  
      for layer in self.model.layers:
          if isinstance(
              layer, (tf.keras.Model, tf.keras.models.Sequential)
          ):  # if there is a model as a layer
              raise NotImplementedError(
                  "Resetting of models with models as layers has not been tested."
              )
          #     self.reset(layer)  # apply recursively
          #     continue
  
          # find initializers
          if hasattr(layer, "cell"):
              init_container = layer.cell
          else:
              init_container = layer
  
          for key, initializer in init_container.__dict__.items():
              if "initializer" not in key:  # not an initializer skip
                  continue
  
              # find the corresponding variable, like the kernel or the bias
              if key == "recurrent_initializer":  # special case check
                  var = getattr(
                      init_container, "recurrent_kernel", None
                  )
              else:
                  var = getattr(
                      init_container,
                      key.replace("_initializer", ""),
                      None,
                  )
  
              if var is not None:
                  var.assign(initializer(var.shape, var.dtype))
  
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 15 for calling the TensorFlowV2Classifier obj's underlying member method code with example usage: obj.reset() without return types