code: def get_class_proportions(dataset, num_class):
      """Computes class proportions in case of label imbalance."""
      labels = []
      for entry in iter(dataset):
          labels.extend(tf.squeeze(entry["label"]).numpy())
      freq = collections.Counter(labels)
      proportions = [freq[i] for i in range(num_class)]
      proportions = np.maximum(proportions / np.sum(proportions), 1e-8)
      return proportions
  
file_path: scenic/scenic/projects/pointcloud/shapenet_dataset.py
imports: import collections
  import dataclasses
  import functools
  from typing import Optional
  from absl import logging
  from flax import jax_utils
  import jax.numpy
  import numpy
  from scenic.dataset_lib import dataset_utils
  from scenic.dataset_lib import datasets
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: get_class_proportions(dataset, num_class) and returns: proportions