Browse Source

feat(mge/uniform): add the judgment of low and high

GitOrigin-RevId: 21788d1992
tags/v1.7.2.m1
Megvii Engine Team 3 years ago
parent
commit
26146e5ab1
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      imperative/python/megengine/random/rng.py

+ 2
- 0
imperative/python/megengine/random/rng.py View File

@@ -106,6 +106,8 @@ def _uniform(
_ref = Tensor([], dtype="int32", device=device)
shape = utils.astensor1d(size, _ref, dtype="int32", device=device)
(output,) = apply(op, shape)
if low == 0 and high == 1:
return output
return low + (high - low) * output




Loading…
Cancel
Save