code: def epoch_rates_to_pmf(problems, epoch_rates=None):
      """Create a probability-mass-function based on relative epoch rates.
  
      if epoch_rates=None, then we use uniform epoch rates [1.0] * len(problems)
      i.e. it takes each problem the same time to go through one epoch.
  
      If epoch_rates is given, then these are the relative numbers of epochs
      of each problem to go through in a given amount of time.
  
      Each must have problem.num_training_examples implemented.
  
      Args:
        problems: a list of Problem instances.
        epoch_rates: an optional list of float
  
      Returns:
        a list of floating point values.
      """
      if epoch_rates is None:
          epoch_rates = [1.0] * len(problems)
      example_rates = [
          epoch_rate * p.num_training_examples
          for p, epoch_rate in zip(problems, epoch_rates)
      ]
      return example_rates_to_pmf(example_rates)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import os
  import numpy
  from tensor2tensor.data_generators import problem
  from tensor2tensor.data_generators import text_problems
  import tensorflow.compat.v1
label_desc: Use image node_id 8 for calling a global function with example usage: epoch_rates_to_pmf(problems, epoch_rates) and returns: example_rates_to_pmf