r"""Element-wise :math:`\sin(x)` function. Calculates an approximation to the sine for each element :math:`x_i` of the input tensor :math:`x`. Each element :math:`x_i` is assumed to be expressed in radians. This function has domain ``(-infinity, +infinity)`` and codomain ``[-1, +1]
(x)
| 1115 | |
| 1116 | |
| 1117 | def sin(x): |
| 1118 | r"""Element-wise :math:`\sin(x)` function. |
| 1119 | |
| 1120 | Calculates an approximation to the sine for each element :math:`x_i` of the input tensor :math:`x`. |
| 1121 | Each element :math:`x_i` is assumed to be expressed in radians. |
| 1122 | |
| 1123 | This function has domain ``(-infinity, +infinity)`` and codomain ``[-1, +1]``. |
| 1124 | |
| 1125 | Args: |
| 1126 | x: input tensor whose elements are each expressed in radians. Should have a floating-point data type. |
| 1127 | |
| 1128 | Returns: |
| 1129 | a tensor containing the sine of each element in :math:`x`. |
| 1130 | The returned tensor must have a floating-point data type determined by :ref:`dtype-promotion`. |
| 1131 | |
| 1132 | Examples: |
| 1133 | >>> F.sin(0) |
| 1134 | Tensor(0.0, device=xpux:0) |
| 1135 | |
| 1136 | Element-wise sine: |
| 1137 | |
| 1138 | >>> import math |
| 1139 | >>> x = Tensor([0, math.pi/2, math.pi]) |
| 1140 | >>> F.sin(x) |
| 1141 | Tensor([ 0. 1. -0.], device=xpux:0) |
| 1142 | """ |
| 1143 | return _elwise(x, mode=Elemwise.Mode.SIN) |
| 1144 | |
| 1145 | |
| 1146 | def tan(x): |