code: def on_batch_end(self, last_output, last_target, **kwargs):
          "Update metric computation with `last_output` and `last_target`."
          if not is_listy(last_target): last_target=[last_target]
          self.count += last_target[0].size(0)
          val = self.func(last_output, *last_target)
          if self.world:
              val = val.clone()
              dist.all_reduce(val, op=dist.ReduceOp.SUM)
              val /= self.world
          self.val += last_target[0].size(0) * val.detach().cpu(f on_batch_end(self, last_output, last_target, **kwargs):
          "Update metric computation with `last_output` and `last_target`."
          if not is_listy(last_target): last_target=[last_target]
          self.count += last_target[0].size(0)
          val = self.func(last_output, *last_target)
          if self.world:
              val = val.clone()
              dist.all_reduce(val, op=dist.ReduceOp.SUM)
              val /= self.world
          self.val += last_target[0].size(0) * val.detach().cpu()
docs: Update metric computation with `last_output` and `last_target`.