code: def fbeta(r, p, beta, average):
      if average:
          return (1 + beta**2) * p * r / (beta**2 * p + r + 1e-20)
      else:
          return torch.mean(
              (1 + beta**2) * p * r / (beta**2 * p + r + 1e-20)
          ).item()
  
file_path: transfer-nlp/tests/plugins/test_trainer.py
imports: import copy
  import unittest
  from pathlib import Path
  import ignite
  import ignite.metrics
  import torch.nn
  import torch.optim
  from ignite.metrics import Precision, Recall, MetricsLambda
  from transfer_nlp.plugins.config import ExperimentConfig
  from transfer_nlp.plugins.regularizers import L1
  from .trainer_utils import *
label_desc: Use image node_id 1 for calling a global function with example usage: fbeta(r, p, beta, average) and returns: unknown, torch