docstr: 获取 tensor 的 scalar 值
  
  :param tensor: 传入的张量
docstr_tok: ["\u83b7\u53d6","tensor","\u7684","scalar","\u503c",":","param","tensor",":","\u4f20\u5165\u7684\u5f20\u91cf"]
code: def get_scalar(self, tensor) -> float:
      """
      获取 tensor 的 scalar 值
  
      :param tensor: 传入的张量
      """
      return tensor.item()
  
file_path: fastNLP/fastNLP/core/metrics/backend/torch_backend/backend.py
imports: from typing import Any, List, Optional
  import numpy
  from fastNLP.core.metrics.backend import Backend
  from fastNLP.core.metrics.utils import AggregateMethodError
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
  from fastNLP.core.drivers.torch_driver.dist_utils import fastnlp_torch_all_gather
label_desc: Use image node_id 5 for calling the TorchBackend obj's underlying member method code with example usage: obj.get_scalar(tensor) and returns: tensor