mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
clamping the return value of uniform.cdf() to [0..1] (#7538)
* fix for #7532: clamping the return value of uniform.cdf() to the range [0,1] * removed whitespace around equals to pass flake8 tests * added a test for uniform.cdf() with arguments outside support
This commit is contained in:
@ -71,7 +71,7 @@ class Uniform(Distribution):
|
||||
if self._validate_args:
|
||||
self._validate_sample(value)
|
||||
result = (value - self.low) / (self.high - self.low)
|
||||
return result
|
||||
return result.clamp(min=0, max=1)
|
||||
|
||||
def icdf(self, value):
|
||||
if self._validate_args:
|
||||
|
||||
Reference in New Issue
Block a user