class_docstr: computes the precision for each class over epochs.
  Args:
      num_classes (int): number of classes.
      average (bool): a way to output one single value for metrics
                      that are calculated in several trials.
class_docstr_tok: ["computes","the","precision","for","each","class","over","epochs",".","Args",":","num_classes","(","int",")",":","number","of","classes",".","average","(","bool",")",":","a","way","to","output","one","single","value","for","metrics","that","are","calculated","in","several","trials","."]
docstr: Update tp, fp and support acoording to output and target.
  
  Args:
      output (tensor): predictions of model
      target (tensor): labels
docstr_tok: ["Update","tp",",","fp","and","support","acoording","to","output","and","target",".","Args",":","output","(","tensor",")",":","predictions","of","model","target","(","tensor",")",":","labels"]
code: def update(self, output=None, target=None):
      """
      Update tp, fp and support acoording to output and target.
  
      Args:
          output (tensor): predictions of model
          target (tensor): labels
      """
      # (batch, 1)
      target = target.view(-1)
  
      # (batch, nclass)
      indices = torch.argmax(output, dim=1).view(-1)
  
      output = indices.type_as(target)
      correct = output.eq(target.expand_as(output))
  
      # Convert from int cuda/cpu to double cpu
      for class_index in target:
          self._positives[class_index] += 1
      for class_index in indices[(correct == 1).nonzero()]:
          self._true_positives[class_index] += 1
  
imports: import dataclasses
  import math
  import warnings
  from collections import defaultdict
  import numpy
  import torch
  from sklearn.metrics import confusion_matrix, auc
  from baal.utils.array_utils import to_prob
label_desc: Use image node_id 3 for calling the Precision obj's underlying member method code with example usage: obj.update(output, target) without return types