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: Callback function for collecting layer output NDArrays.
code: def collect(self, name, op_name, arr):
      """Callback function for collecting layer output NDArrays."""
      if name not in self.include_layers:
          return
      arr = arr.copyto(cpu()).asnumpy()
      if self.logger:
          self.logger.debug(
              f"Collecting layer {name} histogram of shape {arr.shape}"
          )
      min_range = np.min(arr)
      max_range = np.max(arr)
      th = max(abs(min_range), abs(max_range))
      if name in self.hist_dict:
          self.hist_dict[name] = self.combine_histogram(
              self.hist_dict[name], arr, min_range, max_range, th
          )
      else:
          hist, hist_edges = np.histogram(
              arr, bins=self.num_bins, range=(-th, th)
          )
          self.hist_dict[name] = (
              hist,
              hist_edges,
              min_range,
              max_range,
              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 2 for calling the _LayerHistogramCollector obj's underlying member method code with example usage: obj.collect(name, op_name, arr) without return types