code: def reference_perplexity_func(probs):
      ent = entropy(probs, axis=-1)
      ppl = np.exp(ent)
      return ppl.mean()
  
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 4 for calling a global function with example usage: reference_perplexity_func(probs) and returns: ppl