code: def test_binary(self):
      pred = torch.randn(10, 2)
      target = torch.randint(1, size=(10,))
      metric = ClassifyFPreRecMetric()
      metric.update(pred, target)
      results = metric.get_metric()
      print(target)
      print(metric._tp, metric._fp, metric._fn)
      assert results["f"] == results["rec"] == results["pre"]
  
      pred = torch.randn(10, 2)
      target = torch.randint(2, size=(10,))
      metric = ClassifyFPreRecMetric()
      metric.update(pred, target)
      results = metric.get_metric()
      print(target)
      print(metric._tp, metric._fp, metric._fn)
      assert results["f"] == results["rec"] == results["pre"]
  
file_path: fastNLP/tests/core/metrics/test_classify_f1_pre_rec_metric_torch.py
imports: from functools import partial
  import copy
  import pytest
  import numpy
  from fastNLP.core.metrics import ClassifyFPreRecMetric
  from fastNLP.core.dataset import DataSet
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
  from .utils import find_free_network_port, setup_ddp
label_desc: Use image node_id 4 for calling the TestClassfiyFPreRecMetric obj's underlying member method code with example usage: obj.test_binary() without return types