class_docstr: Class used for efficiently run alot of parametrized tests in ddp mode.
  Makes sure that ddp is only setup once and that pool of processes are
  used for all tests.
  All tests should subclass from this and implement a new method called
      `test_metric_name`
  where the method `self.run_metric_test` is called inside.
class_docstr_tok: ["Class","used","for","efficiently","run","alot","of","parametrized","tests","in","ddp","mode",".","Makes","sure","that","ddp","is","only","setup","once","and","that","pool","of","processes","are","used","for","all","tests",".","All","tests","should","subclass","from","this","and","implement","a","new","method","called","`","test_metric_name","`","where","the","method","`","self.run_metric_test","`","is","called","inside","."]
docstr: Main method that should be used for testing functions. Call this inside
  testing method
  Args:
      preds: torch tensor with predictions
      target: torch tensor with targets
      metric_functional: lightning metric class that should be tested
      sk_metric: callable function that is used for comparison
      metric_args: dict with additional arguments used for class initialization
docstr_tok: ["Main","method","that","should","be","used","for","testing","functions",".","Call","this","inside","testing","method","Args",":","preds",":","torch","tensor","with","predictions","target",":","torch","tensor","with","targets","metric_functional",":","lightning","metric","class","that","should","be","tested","sk_metric",":","callable","function","that","is","used","for","comparison","metric_args",":","dict","with","additional","arguments","used","for","class","initialization"]
code: def run_functional_metric_test(
      self,
      preds: torch.Tensor,
      target: torch.Tensor,
      metric_functional: Callable,
      sk_metric: Callable,
      metric_args: dict = {},
  ):
      """Main method that should be used for testing functions. Call this inside
      testing method
      Args:
          preds: torch tensor with predictions
          target: torch tensor with targets
          metric_functional: lightning metric class that should be tested
          sk_metric: callable function that is used for comparison
          metric_args: dict with additional arguments used for class initialization
      """
      _functional_test(
          preds=preds,
          target=target,
          metric_functional=metric_functional,
          sk_metric=sk_metric,
          metric_args=metric_args,
          atol=self.atol,
      )
  
imports: import os
  import pickle
  import sys
  from functools import partial
  from typing import Callable, Optional
  import numpy
  import pytest
  import torch
  from scipy.stats import entropy
  from torch.distributions.utils import logits_to_probs
  from torch.multiprocessing import Pool, set_start_method
  from torchmetrics import Metric
  from nemo.collections.common.metrics import GlobalAverageLossMetric, Perplexity
label_desc: Use image node_id 3 for calling the MetricTester obj's underlying member method code with example usage: obj.run_functional_metric_test(preds, target, metric_functional, sk_metric, metric_args) without return types