class_docstr: 不需要初始化 ``backend`` 的 :class:`AutoBackend`，能够根据 :meth:`get_metric` 时候判断输入数据类型来选择 ``backend``。
class_docstr_tok: ["\u4e0d\u9700\u8981\u521d\u59cb\u5316","``","backend","``","\u7684",":","class",":","`","AutoBackend","`","\uff0c\u80fd\u591f\u6839\u636e",":","meth",":","`","get_metric","`","\u65f6\u5019\u5224\u65ad\u8f93\u5165\u6570\u636e\u7c7b\u578b\u6765\u9009\u62e9","``","backend","``","\u3002"]
docstr: 初始化 backend.
  
  :param backend: 目前支持三种值，为 ``[str, Backend, None]``。
  
      * 当 backend 为 :class:`str` 时， 其只能为 ``'auto'``；
      * 当 backend 为 ``Backend`` 对象时， 其直接使用该对象方法覆盖 :class:`AutoBackend`；
      * 当 backend 为 ``None`` 时， 根据 :meth:`get_metric` 时候判断输入数据类型来选择 ``backend``；
docstr_tok: ["\u521d\u59cb\u5316","backend",".",":","param","backend",":","\u76ee\u524d\u652f\u6301\u4e09\u79cd\u503c\uff0c\u4e3a","``","[","str",",","Backend",",","None","]","``","\u3002","*","\u5f53","backend","\u4e3a",":","class",":","`","str","`","\u65f6\uff0c","\u5176\u53ea\u80fd\u4e3a","``","'auto","'","``","\uff1b","*","\u5f53","backend","\u4e3a","``","Backend","``","\u5bf9\u8c61\u65f6\uff0c","\u5176\u76f4\u63a5\u4f7f\u7528\u8be5\u5bf9\u8c61\u65b9\u6cd5\u8986\u76d6",":","class",":","`","AutoBackend","`","\uff1b","*","\u5f53","backend","\u4e3a","``","None","``","\u65f6\uff0c","\u6839\u636e",":","meth",":","`","get_metric","`","\u65f6\u5019\u5224\u65ad\u8f93\u5165\u6570\u636e\u7c7b\u578b\u6765\u9009\u62e9","``","backend","``","\uff1b"]
code: def __init__(self, backend: Union[str, Backend, None]):
      """
      初始化 backend.
  
      :param backend: 目前支持三种值，为 ``[str, Backend, None]``。
  
          * 当 backend 为 :class:`str` 时， 其只能为 ``'auto'``；
          * 当 backend 为 ``Backend`` 对象时， 其直接使用该对象方法覆盖 :class:`AutoBackend`；
          * 当 backend 为 ``None`` 时， 根据 :meth:`get_metric` 时候判断输入数据类型来选择 ``backend``；
  
      """
      super(AutoBackend, self).__init__()
      if backend != "auto":
          self._convert_backend(backend)
  
file_path: fastNLP/fastNLP/core/metrics/backend/auto_backend.py
imports: from typing import Union
  import sys
  from ....envs.imports import SUPPORT_BACKENDS
  from ...log import logger
  from .backend import Backend
  from .torch_backend.backend import TorchBackend
  from .paddle_backend.backend import PaddleBackend
  from .jittor_backend.backend import JittorBackend
  from .oneflow_backend.backend import OneflowBackend
label_desc: Use image node_id 1 to create a new AutoBackend object from inherited base classes: Backend with example: obj = AutoBackend(backend)