def before_training(self, strategy, **kwargs):
        """Enforce using the PPP-loss and add a NN-classifier."""
        if not self.initialized:
            strategy._criterion = self.ppp_loss
            print("Using the Pseudo-Prototypical-Proxy loss for CoPE.")

            # Normalize representation of last layer
            swap_last_fc_layer(
                strategy.model,
                torch.nn.Sequential(
                    get_last_fc_layer(strategy.model)[1], L2Normalization()
                ),
            )

            # Static prototype init
            # Create prototypes for all classes at once
            if not self.p_init_adaptive and len(self.p_mem) == 0:
                self._init_new_prototypes(
                    torch.arange(0, self.n_classes).to(strategy.device)
                )

            self.initialized = True
Enforce using the PPP-loss and add a NN-classifier.
avalanche/training/plugins/cope.py