Generate a value for each element following a Gaussian distribution. Args: mean (float): mean of the distribution std (float): standard variance of the distribution inplace: inplace flag Returns: this tensor
(self, mean, std, inplace=True)
| 480 | return self |
| 481 | |
| 482 | def gaussian(self, mean, std, inplace=True): |
| 483 | '''Generate a value for each element following a Gaussian distribution. |
| 484 | |
| 485 | Args: |
| 486 | mean (float): mean of the distribution |
| 487 | std (float): standard variance of the distribution |
| 488 | inplace: inplace flag |
| 489 | |
| 490 | Returns: |
| 491 | this tensor |
| 492 | ''' |
| 493 | if not inplace: |
| 494 | # return new tensor |
| 495 | raise NotImplementedError |
| 496 | |
| 497 | singa.Gaussian(float(mean), float(std), self.data) |
| 498 | return self |
| 499 | |
| 500 | def uniform(self, low, high, inplace=True): |
| 501 | '''Generate a value for each element following a uniform distribution. |
no test coverage detected