From 9b74e6fc88ff021e606654e3a9981af71291a77a Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Thu, 16 Apr 2020 18:13:19 +0800 Subject: [PATCH] fix(mge/random): add one assert in distribution.py low must be less than high in uniform sampling GitOrigin-RevId: 34c33a1ac97dc46846af9bda33273219669b0ab5 --- python_module/megengine/random/distribution.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python_module/megengine/random/distribution.py b/python_module/megengine/random/distribution.py index 6565dd08e..55977f9c5 100644 --- a/python_module/megengine/random/distribution.py +++ b/python_module/megengine/random/distribution.py @@ -93,6 +93,8 @@ def uniform( [0.09365904 0.62957656]] """ + assert low < high, "Uniform is not defined when low >= high" + comp_node, comp_graph = _use_default_if_none(comp_node, comp_graph) seed = _random_seed_generator().__next__() return low + (high - low) * mgb.opr.uniform_rng( -- GitLab