

def test_hist(nbin_offset_dim_dtype_inp, device_id):
    '\n    Compare the nervanagpu and nervanacpu hist implementation to the reference\n    implementation above.\n\n    Parameterized test case, uses pytest_generate_test to enumerate dim_dtype_inp\n    tuples that drive the test.\n    '
    ((nbins, offset), dim, dtype, (name, inp_gen)) = nbin_offset_dim_dtype_inp
    gpuflag = (check_gpu.get_compute_capability(0) >= 3.0)
    if (gpuflag is False):
        raise RuntimeError('Device does not have CUDA compute capability 3.0 or greater')
    ng = NervanaGPU(hist_bins=nbins, hist_offset=offset, device_id=device_id)
    nc = NervanaCPU(hist_bins=nbins, hist_offset=offset)
    np_inp = inp_gen(dim).astype(dtype)
    np_hist = ref_hist(np_inp, nbins=nbins, offset=offset)
    for be in [ng, nc]:
        be_inp = be.array(np_inp, dtype=dtype)
        be_hist = be_inp.hist(name)
        assert tensors_allclose(np_hist, be_hist)
    del ng
    del nc

dataset/ETHPy150Open NervanaSystems/neon/neon/backends/tests/test_hist.py test_hist/original