def ref_hist(inp, nbins=64, offset=-48):
    bins = np.arange(nbins + 1) + float(offset)
    bins[0] = -float('Inf')
    np_inp_log_abs = np.rint(np.log2(np.abs(inp.astype(np.float32))))
    np_hist, edges = np.histogram(np_inp_log_abs, density=False, bins=bins)
    if (np_hist.ndim < 2):
        np_hist = np_hist.reshape(1, np_hist.size)
    return np_hist
Implement a log2 histogram geared towards visualizing neural net parameters.
dataset/ETHPy150Open NervanaSystems/neon/neon/backends/tests/test_hist.py/ref_hist