def impl_test_var(self, dtype): x = np.random.normal(scale=5.0, size=(3, 5)) x = x.astype(dtype=dtype, order='C') x_gpu = gpuarray.to_gpu(x) assert np.allclose(misc.var(x_gpu).get(), x.var()) assert np.allclose(misc.var(x_gpu, axis=0).get(), x.var(axis=0)) assert np.allclose(misc.var(x_gpu, axis=1).get(), x.var(axis=1))
def _impl_test_var(self, dtype): x = np.random.normal(scale=5.0, size=(3, 5)) x = x.astype(dtype=dtype, order='C') x_gpu = gpuarray.to_gpu(x) assert_allclose(misc.var(x_gpu).get(), x.var(), rtol=dtype_to_rtol[dtype], atol=dtype_to_atol[dtype]) assert_allclose(misc.var(x_gpu, axis=0).get(), x.var(axis=0), rtol=dtype_to_rtol[dtype], atol=dtype_to_atol[dtype]) assert_allclose(misc.var(x_gpu, axis=1).get(), x.var(axis=1), rtol=dtype_to_rtol[dtype], atol=dtype_to_atol[dtype]) assert_allclose(misc.var(x_gpu, ddof=1).get(), x.var(ddof=1), rtol=dtype_to_rtol[dtype], atol=dtype_to_atol[dtype]) assert_allclose(misc.var(x_gpu, ddof=1, axis=0).get(), x.var(ddof=1, axis=0), rtol=dtype_to_rtol[dtype], atol=dtype_to_atol[dtype]) assert_allclose(misc.var(x_gpu, ddof=1, axis=1).get(), x.var(ddof=1, axis=1), rtol=dtype_to_rtol[dtype], atol=dtype_to_atol[dtype])