Outputs random values from a normal distribution. Args: shape: A 1-D integer Tensor or Python array. The shape of the output tensor. mean: A 0-D Tensor or Python value of type `dtype`. The mean of the normal distribution. stddev: A 0-D Tensor or Python value of
(self, shape, mean=0.0, stddev=1.0, dtype=dtypes.float32,
name=None)
| 392 | # The following functions return a tensor and as a side effect update |
| 393 | # self._state_var. |
| 394 | def normal(self, shape, mean=0.0, stddev=1.0, dtype=dtypes.float32, |
| 395 | name=None): |
| 396 | """Outputs random values from a normal distribution. |
| 397 | |
| 398 | Args: |
| 399 | shape: A 1-D integer Tensor or Python array. The shape of the output |
| 400 | tensor. |
| 401 | mean: A 0-D Tensor or Python value of type `dtype`. The mean of the normal |
| 402 | distribution. |
| 403 | stddev: A 0-D Tensor or Python value of type `dtype`. The standard |
| 404 | deviation of the normal distribution. |
| 405 | dtype: The type of the output. |
| 406 | name: A name for the operation (optional). |
| 407 | |
| 408 | Returns: |
| 409 | A tensor of the specified shape filled with random normal values. |
| 410 | """ |
| 411 | with ops.name_scope(name, "stateful_normal", [shape, mean, stddev]) as name: |
| 412 | shape = _shape_tensor(shape) |
| 413 | mean = ops.convert_to_tensor(mean, dtype=dtype, name="mean") |
| 414 | stddev = ops.convert_to_tensor(stddev, dtype=dtype, name="stddev") |
| 415 | rnd = self._standard_normal(shape, dtype=dtype) |
| 416 | return math_ops.add(rnd * stddev, mean, name=name) |
| 417 | |
| 418 | def _truncated_normal(self, shape, dtype): |
| 419 | return gen_stateful_random_ops.stateful_truncated_normal( |