r"""Element-wise logical NOT. Computes the logical NOT for each element :math:`x_i` of the input tensor :math:`x`. Args: x: input tensor. Should have a boolean data type. Returns: a tensor containing the result of the element-wise logical NOT operation. The ret
(x)
| 1722 | |
| 1723 | |
| 1724 | def logical_not(x): |
| 1725 | r"""Element-wise logical NOT. |
| 1726 | |
| 1727 | Computes the logical NOT for each element :math:`x_i` of the input tensor :math:`x`. |
| 1728 | |
| 1729 | Args: |
| 1730 | x: input tensor. Should have a boolean data type. |
| 1731 | |
| 1732 | Returns: |
| 1733 | a tensor containing the result of the element-wise logical NOT operation. |
| 1734 | The returned tensor must have a data type of ``bool``. |
| 1735 | |
| 1736 | .. seealso:: |
| 1737 | |
| 1738 | :func:`~.logical_and`, :func:`~.logical_or`, :func:`~.logical_xor` |
| 1739 | |
| 1740 | Examples: |
| 1741 | >>> F.logical_not(True) |
| 1742 | Tensor(False, dtype=bool, device=xpux:0) |
| 1743 | |
| 1744 | Element-wise logical NOT: |
| 1745 | |
| 1746 | >>> x = Tensor([True, False, True]) |
| 1747 | >>> F.logical_not(x) |
| 1748 | Tensor([False True False], dtype=bool, device=xpux:0) |
| 1749 | |
| 1750 | The ``~`` operator can be used as a shorthand for ``F.logical_and`` on boolean tensors. |
| 1751 | |
| 1752 | >>> ~x |
| 1753 | Tensor([False True False], dtype=bool, device=xpux:0) |
| 1754 | """ |
| 1755 | return _elwise(x, mode=Elemwise.Mode.NOT) |
| 1756 | |
| 1757 | |
| 1758 | def logical_or(x, y): |
no test coverage detected