code: def update_with_all_losses(self, ts, losses):
      for t, loss in zip(ts, losses):
          if self._loss_counts[t] == self.history_per_term:
              # Shift out the oldest loss term.
              self._loss_history[t, :-1] = self._loss_history[t, 1:]
              self._loss_history[t, -1] = loss
          else:
              self._loss_history[t, self._loss_counts[t]] = loss
              self._loss_counts[t] += 1
  
imports: from abc import ABC, abstractmethod
  import numpy
  import torch
  from scipy.stats import norm
  import torch.distributed
label_desc: Use image node_id 3 for calling the LossSecondMomentResampler obj's underlying member method code with example usage: obj.update_with_all_losses(ts, losses) without return types