class_docstr: 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.
docstr: Args:
      buffer: memory buffer
      grad_dims: gradient dimensions
  Returns: gradient from memory subsets
docstr_tok: ["Args",":","buffer",":","memory","buffer","grad_dims",":","gradient","dimensions","Returns",":","gradient","from","memory","subsets"]
code: def get_rand_mem_grads(self, strategy, grad_dims, gss_batch_size):
      """
      Args:
          buffer: memory buffer
          grad_dims: gradient dimensions
      Returns: gradient from memory subsets
      """
      temp_gss_batch_size = min(
          gss_batch_size, self.ext_mem_list_current_index
      )
      num_mem_subs = min(
          self.mem_strength,
          self.ext_mem_list_current_index // gss_batch_size,
      )
      mem_grads = torch.zeros(
          num_mem_subs,
          sum(grad_dims),
          dtype=torch.float32,
          device=self.device,
      )
      shuffeled_inds = torch.randperm(
          self.ext_mem_list_current_index, device=self.device
      )
      for i in range(num_mem_subs):
          random_batch_inds = shuffeled_inds[
              i * temp_gss_batch_size : i * temp_gss_batch_size
              + temp_gss_batch_size
          ]
          batch_x = self.ext_mem_list_x[random_batch_inds].to(
              strategy.device
          )
          batch_y = self.ext_mem_list_y[random_batch_inds].to(
              strategy.device
          )
          strategy.model.zero_grad()
  
          loss = strategy._criterion(
              strategy.model.forward(batch_x), batch_y
          )
          loss.backward()
          mem_grads[i].data.copy_(
              self.get_grad_vector(strategy.model.parameters, grad_dims)
          )
      return mem_grads
  
file_path: avalanche/avalanche/training/plugins/gss_greedy.py
imports: from typing import TYPE_CHECKING
  import torch
  from avalanche.benchmarks.utils import _make_taskaware_classification_dataset
  from avalanche.benchmarks.utils.data_loader import ReplayDataLoader
  from avalanche.training.plugins.strategy_plugin import SupervisedPlugin
label_desc: Use image node_id 6 for calling the GSS_greedyPlugin obj's underlying member method code with example usage: obj.get_rand_mem_grads(strategy, grad_dims, gss_batch_size) and returns: mem_grads