def _is_uniform(self, tensor, a, b):
if isinstance(tensor, Variable):
tensor = tensor.data
samples = list(tensor.view(-1))
p_value = stats.kstest(samples, 'uniform', args=(a, (b - a))).pvalue
return p_value > 0.0001
文章目录