r"""Element-wise :math:`\operatorname{sqrt}(x)` function. Calculates the square root for each element :math:`x_i` of the input tensor :math:`x`. After rounding, each result must be indistinguishable from the infinitely precise result (as required by IEEE 754). This function has dom
(x: Tensor)
| 760 | |
| 761 | |
| 762 | def sqrt(x: Tensor) -> Tensor: |
| 763 | r"""Element-wise :math:`\operatorname{sqrt}(x)` function. |
| 764 | |
| 765 | Calculates the square root for each element :math:`x_i` of the input tensor :math:`x`. |
| 766 | After rounding, each result must be indistinguishable from the infinitely precise result (as required by IEEE 754). |
| 767 | |
| 768 | This function has domain ``[0, +infinity]`` and codomain ``[0, +infinity]``. |
| 769 | |
| 770 | Args: |
| 771 | x: input tensor. Should have a floating-point data type. |
| 772 | |
| 773 | Returns: |
| 774 | a tensor containing the evaluated square root result for each element in :math:`x`. |
| 775 | The returned tensor must have a floating-point data type determined by :ref:`dtype-promotion`. |
| 776 | |
| 777 | .. admonition:: Special cases |
| 778 | |
| 779 | For floating-point operands, |
| 780 | |
| 781 | * If :math:`x_i` is ``NaN``, the result is ``NaN``. |
| 782 | * If :math:`x_i` is less than ``0``, the result is ``NaN``. |
| 783 | * If :math:`x_i` is ``+0``, the result is ``+0``. |
| 784 | * If :math:`x_i` is ``-0``, the result is ``-0``. |
| 785 | * If :math:`x_i` is ``+infinity``, the result is ``+infinity``. |
| 786 | |
| 787 | Examples: |
| 788 | >>> F.sqrt(4) |
| 789 | Tensor(2.0, device=xpux:0) |
| 790 | |
| 791 | Element-wise square root: |
| 792 | |
| 793 | >>> x = Tensor([1, 4, 9, 16]) |
| 794 | >>> F.sqrt(x) |
| 795 | Tensor([1. 2. 3. 4.], device=xpux:0) |
| 796 | |
| 797 | """ |
| 798 | return _elwise(x, mode=Elemwise.Mode.SQRT) |
| 799 | |
| 800 | |
| 801 | def square(x: Tensor) -> Tensor: |
no test coverage detected