class_docstr: Tests for BERTScore.
class_docstr_tok: ["Tests","for","BERTScore","."]
docstr: Test the bertscore functional.
docstr_tok: ["Test","the","bertscore","functional","."]
code: def test_bertscore_functional(
      self,
      preds,
      targets,
      num_layers,
      all_layers,
      idf,
      rescale_with_baseline,
      metric_key,
  ):
      """Test the bertscore functional."""
      metric_args = {
          "model_name_or_path": MODEL_NAME,
          "num_layers": num_layers,
          "all_layers": all_layers,
          "idf": idf,
          "rescale_with_baseline": rescale_with_baseline,
      }
      reference_bert_score_metric = partial(
          _reference_bert_score,
          num_layers=num_layers,
          all_layers=all_layers,
          idf=idf,
          rescale_with_baseline=rescale_with_baseline,
          metric_key=metric_key,
      )
  
      self.run_functional_metric_test(
          preds,
          targets,
          metric_functional=bert_score,
          reference_metric=reference_bert_score_metric,
          metric_args=metric_args,
          key=metric_key,
      )
  
file_path: torchmetrics/tests/unittests/text/test_bertscore.py
imports: import os
  from functools import partial
  from typing import Sequence
  import pytest
  from torch import Tensor
  from torchmetrics.functional.text.bert import bert_score
  from torchmetrics.text.bert import BERTScore
  from torchmetrics.utilities.imports import _BERTSCORE_AVAILABLE, _TRANSFORMERS_GREATER_EQUAL_4_4
  from typing_extensions import Literal
  from unittests.text.helpers import TextTester, skip_on_connection_issues
  from unittests.text.inputs import _inputs_single_reference
label_desc: Use image node_id 2 for calling the TestBERTScore obj's underlying member method code with example usage: obj.test_bertscore_functional(preds, targets, num_layers, all_layers, idf, rescale_with_baseline, metric_key) without return types