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)
| 511 | return self |
| 512 | |
| 513 | def gaussian(self, mean, std, inplace=True): |
| 514 | '''Generate a value for each element following a Gaussian distribution. |
| 515 | |
| 516 | Args: |
| 517 | mean (float): mean of the distribution |
| 518 | std (float): standard variance of the distribution |
| 519 | inplace: inplace flag |
| 520 | |
| 521 | Returns: |
| 522 | this tensor |
| 523 | ''' |
| 524 | if not inplace: |
| 525 | # return new tensor |
| 526 | raise NotImplementedError |
| 527 | |
| 528 | singa.Gaussian(float(mean), float(std), self.data) |
| 529 | return self |
| 530 | |
| 531 | def uniform(self, low, high, inplace=True): |
| 532 | '''Generate a value for each element following a uniform distribution. |