class_docstr: Saves layer histogram in a dict with layer names as keys and lists of NDArrays as
  values. The collected histogram will be used for calculating the optimal thresholds for
  quantization using KL divergence.
class_docstr_tok: ["Saves","layer","histogram","in","a","dict","with","layer","names","as","keys","and","lists","of","NDArrays","as","values",".","The","collected","histogram","will","be","used","for","calculating","the","optimal","thresholds","for","quantization","using","KL","divergence","."]
docstr: Collect layer histogram for arr and combine it with old histogram.
code: def combine_histogram(old_hist, arr, new_min, new_max, new_th):
      """Collect layer histogram for arr and combine it with old histogram."""
      (old_hist, old_hist_edges, old_min, old_max, old_th) = old_hist
      if new_th <= old_th:
          hist, _ = np.histogram(
              arr, bins=len(old_hist), range=(-old_th, old_th)
          )
          return (
              old_hist + hist,
              old_hist_edges,
              min(old_min, new_min),
              max(old_max, new_max),
              old_th,
          )
      else:
          # Need to generate new histogram with new_th
          old_num_bins = len(old_hist)
          old_step = 2 * old_th / old_num_bins
          half_increased_bins = int((new_th - old_th) // old_step + 1)
          new_num_bins = half_increased_bins * 2 + old_num_bins
          new_th = half_increased_bins * old_step + old_th
          hist, hist_edges = np.histogram(
              arr, bins=new_num_bins, range=(-new_th, new_th)
          )
          hist[
              half_increased_bins : new_num_bins - half_increased_bins
          ] += old_hist
          return (
              hist,
              hist_edges,
              min(old_min, new_min),
              max(old_max, new_max),
              new_th,
          )
  
imports: import abc
  import ctypes
  import logging
  import os
  import warnings
  import numpy
  import mxnet
  from ..base import _LIB, check_call, py_str
  from ..base import c_array, c_str, mx_uint, mx_real_t, c_str_array
  from ..base import SymbolHandle
  from ..symbol import Symbol
  from ..None import ndarray
  from ..io import DataDesc
  from ..device import cpu, Device
  from ..util import is_np_array, wrap_ctx_to_device_func
label_desc: Use image node_id 4 for calling the _LayerHistogramCollector obj's underlying member method code with example usage: obj.combine_histogram(old_hist, arr, new_min, new_max, new_th) and returns: unknown,  old_hist_edges,  min,  max,  old_th, hist,  hist_edges,  min,  max,  new_th