code: def __call__(self, output: torch.Tensor, target: torch.Tensor):
      output = output.view(-1, output.shape[-1])
      target = target.view(-1)
      pred = output.argmax(dim=-1)
      mask = target == self.ignore_index
      pred.masked_fill_(mask, self.ignore_index)
      n_masked = mask.sum().item()
      self.data.correct += pred.eq(target).sum().item() - n_masked
      self.data.samples += len(target) - n_masked
  
imports: import dataclasses
  import torch
  from labml import tracker
  from .None import Metric
label_desc: Use image node_id 2 for calling the Accuracy obj's underlying member method code with example usage: obj.__call__(output, target) without return types