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))

        Resets the weights of the classifier so that it can be refit from scratch.
        
art/estimators/classification/tensorflow.py