Gaussian Error Linear Unit. This is a smoother version of the RELU. Original paper: https://arxiv.org/abs/1606.08415 Args: x: float Tensor to perform activation. Returns: `x` with the GELU activation applied.
(x)
| 278 | |
| 279 | |
| 280 | def gelu(x): |
| 281 | """Gaussian Error Linear Unit. |
| 282 | |
| 283 | This is a smoother version of the RELU. |
| 284 | Original paper: https://arxiv.org/abs/1606.08415 |
| 285 | Args: |
| 286 | x: float Tensor to perform activation. |
| 287 | |
| 288 | Returns: |
| 289 | `x` with the GELU activation applied. |
| 290 | """ |
| 291 | cdf = 0.5 * (1.0 + tf.tanh( |
| 292 | (np.sqrt(2 / np.pi) * (x + 0.044715 * tf.pow(x, 3))))) |
| 293 | return x * cdf |
| 294 | |
| 295 | |
| 296 | def get_activation(activation_string): |
nothing calls this directly
no outgoing calls
no test coverage detected