Normalizes along last dimension using an L2 norm. For a 1-D tensor, computes output = x / sqrt(max(sum(x**2), epsilon)) For `x` with more dimensions, independently normalizes each 1-D slice along lastdimension. Args: x: A `Tensor`. epsilon: A lower bound value for the norm.
(x, epsilon=1e-12, name=None)
| 653 | return math_ops.multiply(x, x_inv_norm, name=name) |
| 654 | |
| 655 | def fused_l2_normalize(x, epsilon=1e-12, name=None): |
| 656 | """Normalizes along last dimension using an L2 norm. |
| 657 | |
| 658 | For a 1-D tensor, computes |
| 659 | |
| 660 | output = x / sqrt(max(sum(x**2), epsilon)) |
| 661 | |
| 662 | For `x` with more dimensions, independently normalizes each 1-D slice along |
| 663 | lastdimension. |
| 664 | |
| 665 | Args: |
| 666 | x: A `Tensor`. |
| 667 | epsilon: A lower bound value for the norm. Will use `sqrt(epsilon)` as the |
| 668 | divisor if `norm < sqrt(epsilon)`. |
| 669 | name: A name for this operation (optional). |
| 670 | |
| 671 | Returns: |
| 672 | A `Tensor` with the same shape as `x`. |
| 673 | """ |
| 674 | with ops.name_scope(name, "fused_l2_normalize", [x]) as name: |
| 675 | x = ops.convert_to_tensor(x, name="x") |
| 676 | return gen_fused_l2_normalize_ops.fused_l2_normalize(x, |
| 677 | epsilon=epsilon, name=name) |
| 678 | |
| 679 | @tf_export("nn.fused_layer_normalize") |
| 680 | def fused_layer_normalize( |
no test coverage detected