r""" Inplace version of ``sinc`` API, the output Tensor will be inplaced with input ``x``. Please refer to :ref:`api_paddle_sinc`.
(x: Tensor, name: str | None = None)
| 6696 | |
| 6697 | @inplace_apis_in_dygraph_only |
| 6698 | def sinc_(x: Tensor, name: str | None = None) -> Tensor: |
| 6699 | r""" |
| 6700 | Inplace version of ``sinc`` API, the output Tensor will be inplaced with input ``x``. |
| 6701 | Please refer to :ref:`api_paddle_sinc`. |
| 6702 | """ |
| 6703 | if not isinstance(x, (paddle.Tensor, Variable)): |
| 6704 | raise TypeError(f"x must be tensor type, but got {type(x)}") |
| 6705 | |
| 6706 | check_variable_and_dtype( |
| 6707 | x, |
| 6708 | "x", |
| 6709 | [ |
| 6710 | 'uint16', |
| 6711 | 'float16', |
| 6712 | 'float32', |
| 6713 | 'float64', |
| 6714 | ], |
| 6715 | "sinc_", |
| 6716 | ) |
| 6717 | |
| 6718 | paddle.where_(x != 0, x, paddle.full_like(x, 1.0e-20)) |
| 6719 | paddle.multiply_(x, paddle.to_tensor(math.pi, dtype=x.dtype)) |
| 6720 | tmp = paddle.clone(x) |
| 6721 | paddle.sin_(x) |
| 6722 | paddle.divide_(x, tmp) |
| 6723 | return paddle.where(~paddle.isnan(x), x, paddle.full_like(x, 1.0)) |
| 6724 | |
| 6725 | |
| 6726 | @param_two_alias(["x", "elements"], ["test_x", "test_elements"]) |
nothing calls this directly
no test coverage detected