code: def compute_count_per_bin(bin_num, votes):
      """Tabulates number of examples in each bin.
  
      Args:
        bin_num: Number of bins.
        votes: A matrix of votes, where each row contains votes in one instance.
  
      Returns:
        Array of counts of length bin_num.
      """
      sums = np.sum(votes, axis=1)
      # Check that all rows contain the same number of votes.
      assert max(sums) == min(sums)
  
      s = max(sums)
  
      counts = np.zeros(bin_num)
      n = votes.shape[0]
  
      for i in xrange(n):
          v = votes[i,]
          bin_idx = int(math.floor(max(v) * bin_num / s))
          assert 0 <= bin_idx < bin_num
          counts[bin_idx] += 1
  
      return counts
  
file_path: privacy/research/pate_2018/ICLR2018/rdp_bucketized.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import os
  import sys
  from absl import app
  from absl import flags
  import core
  import matplotlib
  import matplotlib.pyplot
  import numpy
  from six.moves import xrange
label_desc: Use image node_id 1 for calling a global function with example usage: compute_count_per_bin(bin_num, votes) and returns: counts