class_docstr: 计算 准确率 的 metric 。
  
  :param backend: 目前支持五种类型的backend, ``['auto', 'torch', 'paddle', 'jittor', 'oneflow']``。其中 ``'auto'`` 表示根据实际调用
      :meth:`update` 函数时传入的参数决定具体的 backend ，一般情况下直接使用 ``'auto'`` 即可。
  :param aggregate_when_get_metric: 在计算 metric 的时候是否自动将各个进程上的相同的 element 的数字聚合后再得到 metric，
      当 ``backend`` 不支持分布式时，该参数无意义。如果为 ``None`` ，将在 :class:`~fastNLP.core.controllers.Evaluator` 
      中根据 ``sampler`` 是否使用分布式进行自动设置。
class_docstr_tok: ["\u8ba1\u7b97","\u51c6\u786e\u7387","\u7684","metric","\u3002",":","param","backend",":","\u76ee\u524d\u652f\u6301\u4e94\u79cd\u7c7b\u578b\u7684backend",",","``","[","'auto","'",",","'torch","'",",","'paddle","'",",","'jittor","'",",","'oneflow","'","]","``","\u3002\u5176\u4e2d","``","'auto","'","``","\u8868\u793a\u6839\u636e\u5b9e\u9645\u8c03\u7528",":","meth",":","`","update","`","\u51fd\u6570\u65f6\u4f20\u5165\u7684\u53c2\u6570\u51b3\u5b9a\u5177\u4f53\u7684","backend","\uff0c\u4e00\u822c\u60c5\u51b5\u4e0b\u76f4\u63a5\u4f7f\u7528","``","'auto","'","``","\u5373\u53ef\u3002",":","param","aggregate_when_get_metric",":","\u5728\u8ba1\u7b97","metric","\u7684\u65f6\u5019\u662f\u5426\u81ea\u52a8\u5c06\u5404\u4e2a\u8fdb\u7a0b\u4e0a\u7684\u76f8\u540c\u7684","element","\u7684\u6570\u5b57\u805a\u5408\u540e\u518d\u5f97\u5230","metric\uff0c","\u5f53","``","backend","``","\u4e0d\u652f\u6301\u5206\u5e03\u5f0f\u65f6\uff0c\u8be5\u53c2\u6570\u65e0\u610f\u4e49\u3002\u5982\u679c\u4e3a","``","None","``","\uff0c\u5c06\u5728",":","class",":","`","~fastNLP.core.controllers.Evaluator","`","\u4e2d\u6839\u636e","``","sampler","``","\u662f\u5426\u4f7f\u7528\u5206\u5e03\u5f0f\u8fdb\u884c\u81ea\u52a8\u8bbe\u7f6e\u3002"]
docstr: :meth:`get_metric` 函数将根据 :meth:`update` 函数累计的评价指标统计量来计算最终的评价结果。
  
  :return: 包含以下内容的字典：``{"acc": float, 'total': float, 'correct': float}``；
docstr_tok: [":","meth",":","`","get_metric","`","\u51fd\u6570\u5c06\u6839\u636e",":","meth",":","`","update","`","\u51fd\u6570\u7d2f\u8ba1\u7684\u8bc4\u4ef7\u6307\u6807\u7edf\u8ba1\u91cf\u6765\u8ba1\u7b97\u6700\u7ec8\u7684\u8bc4\u4ef7\u7ed3\u679c\u3002",":","return",":","\u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\u7684\u5b57\u5178\uff1a","``","{","``","acc","''",":","float",",","'total","'",":","float",",","'correct","'",":","float","}","``","\uff1b"]
code: def get_metric(self) -> dict:
      r"""
      :meth:`get_metric` 函数将根据 :meth:`update` 函数累计的评价指标统计量来计算最终的评价结果。
  
      :return: 包含以下内容的字典：``{"acc": float, 'total': float, 'correct': float}``；
      """
      evaluate_result = {
          "acc": round(
              self.correct.get_scalar()
              / (self.total.get_scalar() + 1e-12),
              6,
          )
      }
      return evaluate_result
  
file_path: fastNLP/fastNLP/core/metrics/accuracy.py
imports: from typing import Union
  import numpy
  from fastNLP.core.metrics.metric import Metric
  from fastNLP.core.metrics.backend import Backend
  from fastNLP.core.utils.seq_len_to_mask import seq_len_to_mask
  from fastNLP.core.log import logger
label_desc: Use image node_id 2 for calling the Accuracy obj's underlying member method code with example usage: obj.get_metric() and returns: evaluate_result