

def ref_hist(inp, nbins=64, offset=(- 48)):
    '\n    Implement a log2 histogram geared towards visualizing neural net parameters.\n\n    Bins are computed as the log2 of the magnitude of a tensor value.  Bins are\n    rounded to the nearest int.\n\n    Smallest value bin extends to -Inf to enable visualization of zeros.\n\n    Log2 computation is always done in fp32 regardless of input dtype to give\n    rounding a consistent behavior.\n    '
    bins = (np.arange((nbins + 1)) + float(offset))
    bins[0] = (- float('Inf'))
    np_inp_log_abs = np.rint(np.log2(np.abs(np_hist.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

dataset/ETHPy150Open NervanaSystems/neon/neon/backends/tests/test_hist.py ref_hist/VarMisuse@70/236 `inp`->`np_hist`