code: def update(self, pred, target):
      if self.cumulative_dice is None:
          self.cumulative_dice = torch.zeros(
              1, dtype=pred.dtype, device=pred.device
          )
      if self.count is None:
          self.count = torch.zeros(
              1, dtype=pred.dtype, device=pred.device
          )
      # compute the Dice score, ignoring background
      pred = (
          F.one_hot(pred.argmax(dim=1), self.num_classes)
          .permute(0, 3, 1, 2)
          .float()
      )
      dice_target = build_target(
          target, self.num_classes, self.ignore_index
      )
      self.cumulative_dice += multiclass_dice_coeff(
          pred[:, 1:],
          dice_target[:, 1:],
          ignore_index=self.ignore_index,
      )
      self.count += 1
  
imports: from collections import defaultdict, deque
  import datetime
  import time
  import torch
  import torch.nn.functional
  import torch.distributed
  import errno
  import os
  from .dice_coefficient_loss import multiclass_dice_coeff, build_target
label_desc: Use image node_id 2 for calling the DiceCoefficient obj's underlying member method code with example usage: obj.update(pred, target) without return types