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)))[1]
return p_value > 0.0001