class avalanche.training.plugins.GSS_greedyPlugin(mem_size=200, mem_strength=5, input_size=[])[source]

GSSPlugin replay plugin.

Code adapted from the repository: https://github.com/RaptorMai/online-continual-learning Handles an external memory fulled with samples selected using the Greedy approach of GSS algorithm. before_forward callback is used to process the current sample and estimate a score.

__init__(mem_size=200, mem_strength=5, input_size=[])[source]
  • mem_size – total number of patterns to be stored in the external memory.

  • mem_strength

  • input_size


__init__([mem_size, mem_strength, input_size])

param mem_size

total number of patterns to be stored

after_backward(strategy, *args, **kwargs)

Called after criterion.backward() by the BaseTemplate.

after_eval(strategy, *args, **kwargs)

Called after eval by the BaseTemplate.

after_eval_dataset_adaptation(strategy, ...)

Called after eval_dataset_adaptation by the BaseTemplate.

after_eval_exp(strategy, *args, **kwargs)

Called after eval_exp by the BaseTemplate.

after_eval_forward(strategy, *args, **kwargs)

Called after model.forward() by the BaseTemplate.

after_eval_iteration(strategy, *args, **kwargs)

Called after the end of an iteration by the BaseTemplate.

after_forward(strategy[, num_workers, shuffle])

After every forward this function select sample to fill the memory buffer based on cosine similarity

after_train_dataset_adaptation(strategy, ...)

Called after train_dataset_adapatation by the BaseTemplate.

after_training(strategy, *args, **kwargs)

Called after train by the BaseTemplate.

after_training_epoch(strategy, *args, **kwargs)

Called after train_epoch by the BaseTemplate.

after_training_exp(strategy, *args, **kwargs)

Called after train_exp by the BaseTemplate.

after_training_iteration(strategy, *args, ...)

Called after the end of a training iteration by the BaseTemplate.

after_update(strategy, *args, **kwargs)

Called after optimizer.update() by the BaseTemplate.

before_backward(strategy, *args, **kwargs)

Called before criterion.backward() by the BaseTemplate.

before_eval(strategy, *args, **kwargs)

Called before eval by the BaseTemplate.

before_eval_dataset_adaptation(strategy, ...)

Called before eval_dataset_adaptation by the BaseTemplate.

before_eval_exp(strategy, *args, **kwargs)

Called before eval_exp by the BaseTemplate.

before_eval_forward(strategy, *args, **kwargs)

Called before model.forward() by the BaseTemplate.

before_eval_iteration(strategy, *args, **kwargs)

Called before the start of a training iteration by the BaseTemplate.

before_forward(strategy, *args, **kwargs)

Called before model.forward() by the BaseTemplate.

before_train_dataset_adaptation(strategy, ...)

Called before train_dataset_adapatation by the BaseTemplate.

before_training(strategy, **kwargs)

Called before train by the BaseTemplate.

before_training_epoch(strategy, *args, **kwargs)

Called before train_epoch by the BaseTemplate.

before_training_exp(strategy[, num_workers, ...])

Dataloader to build batches containing examples from both memories and the training dataset

before_training_iteration(strategy, *args, ...)

Called before the start of a training iteration by the BaseTemplate.

before_update(strategy, *args, **kwargs)

Called before optimizer.update() by the BaseTemplate.

cosine_similarity(x1[, x2, eps])

get_batch_sim(strategy, grad_dims, batch_x, ...)


get_each_batch_sample_sim(strategy, ...)


get_grad_vector(pp, grad_dims)

gather the gradients in one vector

get_rand_mem_grads(strategy, grad_dims, ...)