code: def histogram(
      self, X, lower_bound=0.0, upper_bound=1.0, num_buckets=20
  ):
      assert (
          X.ndim == 2
      ), "this test assume 2d array,  but X.ndim is {0}".format(X.ndim)
      N, M = X.shape
      hist = np.zeros((num_buckets + 2,), dtype=np.int32)
      segment = (upper_bound - lower_bound) / num_buckets
      Y = np.zeros((N, M), dtype=np.int32)
      Y[X < lower_bound] = 0
      Y[X >= upper_bound] = num_buckets + 1
      Y[(X >= lower_bound) & (X < upper_bound)] = (
          (X[(X >= lower_bound) & (X < upper_bound)] - lower_bound)
          / segment
          + 1
      ).astype(np.int32)
  
      for i in range(Y.shape[0]):
          for j in range(Y.shape[1]):
              hist[Y[i][j]] += 1
  
      cur_hist = hist.astype(np.float32) / (N * M)
      acc_hist = cur_hist
      return [cur_hist, acc_hist]
  
file_path: pytorch/caffe2/python/modeling/compute_histogram_for_blobs_test.py
imports: import unittest
  from caffe2.python import workspace, brew, model_helper
  from caffe2.python.modeling.compute_histogram_for_blobs import ComputeHistogramForBlobs
  import numpy
label_desc: Use image node_id 1 for calling the ComputeHistogramForBlobsTest obj's underlying member method code with example usage: obj.histogram(X, lower_bound, upper_bound, num_buckets) and returns: list