r"""Element-wise maximum of tensor elements. Compare two tensors and returns a new tensor containing the element-wise maxima. If one of the elements being compared is a ``NaN``, then that element is returned. If both elements are ``NaNs`` then the first is returned. Args:
(x, y)
| 963 | |
| 964 | |
| 965 | def maximum(x, y): |
| 966 | r"""Element-wise maximum of tensor elements. |
| 967 | |
| 968 | Compare two tensors and returns a new tensor containing the element-wise maxima. |
| 969 | If one of the elements being compared is a ``NaN``, then that element is returned. |
| 970 | If both elements are ``NaNs`` then the first is returned. |
| 971 | |
| 972 | Args: |
| 973 | |
| 974 | x: input tensor. Should have a numeric data type. |
| 975 | y: input tensor. Should have the same data type as :math:`x`. |
| 976 | |
| 977 | Returns: |
| 978 | |
| 979 | a tensor containing the element-wise maxima. |
| 980 | The returned tensor must have the same data type as :math:`x`. |
| 981 | |
| 982 | Examples: |
| 983 | >>> F.maximum(1, 2) |
| 984 | Tensor(2, dtype=int32, device=xpux:0) |
| 985 | |
| 986 | Element-wise maximum: |
| 987 | |
| 988 | >>> x = Tensor([1, 2, 3, 4]) |
| 989 | >>> y = Tensor([4, 3, 2, 1]) |
| 990 | >>> F.maximum(x, y) |
| 991 | Tensor([4 3 3 4], dtype=int32, device=xpux:0) |
| 992 | |
| 993 | Broadcasting: |
| 994 | |
| 995 | >>> x = Tensor([1, 2, 3, 4]) |
| 996 | >>> F.maximum(x, 2) |
| 997 | Tensor([2 2 3 4], dtype=int32, device=xpux:0) |
| 998 | |
| 999 | """ |
| 1000 | return _elwise(x, y, mode=Elemwise.Mode.MAX) |
| 1001 | |
| 1002 | |
| 1003 | def minimum(x, y): |
no test coverage detected