Browse Source

fix(mge/random): add one assert in distribution.py

low must be less than high in uniform sampling

GitOrigin-RevId: 34c33a1ac9
tags/v0.4.0
Megvii Engine Team Xinran Xu 5 years ago
parent
commit
9b74e6fc88
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      python_module/megengine/random/distribution.py

+ 2
- 0
python_module/megengine/random/distribution.py View File

@@ -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(


Loading…
Cancel
Save