class_docstr:     Calculate precision, recall, F1 for each labels
  
  Parameters
  ----------
  metrics: list
      Indicate the metric for the class to return.
      Note that each metric must be one of ``precision``, ``recall``, ``F1``, ``accuracy``.
      And the results' order is the same as the metrics.
class_docstr_tok: ["Calculate","precision",",","recall",",","F1","for","each","labels","Parameters","--","--","--","--","--","metrics",":","list","Indicate","the","metric","for","the","class","to","return",".","Note","that","each","metric","must","be","one","of","``","precision","``",",","``","recall","``",",","``","F1","``",",","``","accuracy","``",".","And","the","results","'","order","is","the","same","as","the","metrics","."]
docstr:     The function performs division and handles zero-division situations.
  
  Parameters
  ----------
  numerator: numpy.ndarray
  denominator: numpy.ndarray
  zero_division: "warning", 0, 1, default="warning"
      Sets the value to return when there is a zero division.
  
      If set to "warning", this acts as 0, but warnings are also raised.
  Returns
  -------
  results: numpy.ndarray
      The division results.
docstr_tok: ["The","function","performs","division","and","handles","zero-division","situations",".","Parameters","--","--","--","--","--","numerator",":","numpy.ndarray","denominator",":","numpy.ndarray","zero_division",":","``","warning","''",",","0",",","1",",","default=","''","warning","''","Sets","the","value","to","return","when","there","is","a","zero","division",".","If","set","to","``","warning","''",",","this","acts","as","0",",","but","warnings","are","also","raised",".","Returns","--","--","--","-","results",":","numpy.ndarray","The","division","results","."]
code: def _prf_divide(numerator, denominator, zero_division):
      """
          The function performs division and handles zero-division situations.
  
      Parameters
      ----------
      numerator: numpy.ndarray
      denominator: numpy.ndarray
      zero_division: "warning", 0, 1, default="warning"
          Sets the value to return when there is a zero division.
  
          If set to "warning", this acts as 0, but warnings are also raised.
      Returns
      -------
      results: numpy.ndarray
          The division results.
  
      """
      zero_mask = denominator == 0.0
      denominator_cp = copy.deepcopy(denominator)
      denominator_cp[zero_mask] = 1.0
      ret = numerator / denominator_cp
      if np.sum(zero_mask) == 0:
          return ret
      ret[zero_mask] = 0.0 if zero_division in ["warning", 0] else 1.0
      if zero_division == "warning":
          warnings.warn("zero division encountered")
      return ret
  
file_path: graph4nlp/graph4nlp/pytorch/modules/evaluation/accuracy.py
imports: import copy
  import warnings
  import numpy
  import torch
  from graph4nlp.pytorch.modules.evaluation.base import EvaluationMetricBase
label_desc: Use image node_id 3 for calling the Accuracy obj's underlying member method code with example usage: obj._prf_divide(numerator, denominator, zero_division) and returns: ret, ret