def _update_running_prototypes(self, strategy):
        """Accumulate seen outputs of the network and keep counts."""
        y_unique = torch.unique(strategy.mb_y).squeeze().view(-1)
        for idx in range(y_unique.size(0)):
            c = y_unique[idx].item()
            idxs = torch.nonzero(strategy.mb_y == c).squeeze(1)
            p_tmp_batch = (
                strategy.mb_output[idxs].sum(dim=0).unsqueeze(0).to(strategy.device)
            )

            p_init, cnt_init = self.tmp_p_mem[c] if c in self.tmp_p_mem else (0, 0)
            self.tmp_p_mem[c] = (p_init + p_tmp_batch, cnt_init + len(idxs))
Accumulate seen outputs of the network and keep counts.
avalanche/training/plugins/cope.py