| 27 | namespace tensorflow { |
| 28 | |
| 29 | xla::XlaOp TruncatedNormal(xla::XlaOp uniform) { |
| 30 | const double kA = -2.0; |
| 31 | const double kB = 2.0; |
| 32 | const double kMu = 0.0; |
| 33 | const double kSigma = 1.0; |
| 34 | return ParameterizedTruncatedNormal( |
| 35 | uniform, xla::ScalarLike(uniform, kMu), xla::ScalarLike(uniform, kSigma), |
| 36 | xla::ScalarLike(uniform, kA), xla::ScalarLike(uniform, kB)); |
| 37 | } |
| 38 | |
| 39 | // Implements the sampling of truncated normal distribution using the |
| 40 | // inversed cumulative distribution function (CDF) method as described in |
no test coverage detected