def test_optimizer_groups_clf_til(self):
        """
        Tests the automatic assignation of new
        MultiHead parameters to the optimizer
        """
        model, criterion, benchmark = self.init_scenario(multi_task=True)

        g1 = []
        g2 = []
        for n, p in model.named_parameters():
            if "classifier" in n:
                g1.append(p)
            else:
                g2.append(p)

        agent = Agent()
        agent.model = model
        optimizer = SGD([{"params": g1, "lr": 0.1}, {"params": g2, "lr": 0.05}])
        agent.optimizer = DynamicOptimizer(optimizer, model=model, verbose=False)

        for experience in benchmark.train_stream:
            avalanche_model_adaptation(model, experience)
            agent.optimizer.pre_adapt(agent, experience)

            for n, p in model.named_parameters():
                assert self._is_param_in_optimizer(p, agent.optimizer.optim)
                if "classifier" in n:
                    self.assertEqual(
                        self._is_param_in_optimizer_group(p, agent.optimizer.optim), 0
                    )
                else:
                    self.assertEqual(
                        self._is_param_in_optimizer_group(p, agent.optimizer.optim), 1
                    )

        Tests the automatic assignation of new
        MultiHead parameters to the optimizer
        
tests/models/test_dynamic_optimizers.py