def clone_for_refitting(self) -> "PyTorchClassifier":
        """
        Create a copy of the classifier that can be refit from scratch. Will inherit same architecture, same type of
        optimizer and initialization as the original classifier, but without weights.

        :return: new estimator
        """
        model = copy.deepcopy(self.model)

        if self._optimizer is None:  # pragma: no cover
            raise ValueError("An optimizer is needed to train the model, but none is provided.")

        # create a new optimizer that binds to the cloned model's parameters and uses original optimizer's defaults
        new_optimizer = type(self._optimizer)(model.parameters(), **self._optimizer.defaults)  # type: ignore

        clone = type(self)(model, self._loss, self.input_shape, self.nb_classes, optimizer=new_optimizer)

        # reset weights
        clone.reset()
        params = self.get_params()
        del params["model"]
        del params["optimizer"]
        clone.set_params(**params)
        return clone

        Create a copy of the classifier that can be refit from scratch. Will inherit same architecture, same type of
        optimizer and initialization as the original classifier, but without weights.

        :return: new estimator
        
art/estimators/classification/pytorch.py