|
76 | 76 | "dpnp_logical_not",
|
77 | 77 | "dpnp_logical_or",
|
78 | 78 | "dpnp_logical_xor",
|
| 79 | + "dpnp_maximum", |
| 80 | + "dpnp_minimum", |
79 | 81 | "dpnp_multiply",
|
80 | 82 | "dpnp_negative",
|
81 | 83 | "dpnp_positive",
|
@@ -1813,6 +1815,98 @@ def dpnp_logical_xor(x1, x2, out=None, order="K"):
|
1813 | 1815 | return dpnp_array._create_from_usm_ndarray(res_usm)
|
1814 | 1816 |
|
1815 | 1817 |
|
| 1818 | +_maximum_docstring_ = """ |
| 1819 | +maximum(x1, x2, out=None, order='K') |
| 1820 | +
|
| 1821 | +Compares two input arrays `x1` and `x2` and returns |
| 1822 | +a new array containing the element-wise maxima. |
| 1823 | +
|
| 1824 | +Args: |
| 1825 | + x1 (dpnp.ndarray): |
| 1826 | + First input array, expected to have numeric data type. |
| 1827 | + x2 (dpnp.ndarray): |
| 1828 | + Second input array, also expected to have numeric data type. |
| 1829 | + out ({None, dpnp.ndarray}, optional): |
| 1830 | + Output array to populate. |
| 1831 | + Array have the correct shape and the expected data type. |
| 1832 | + order ("C","F","A","K", optional): |
| 1833 | + Memory layout of the newly output array, if parameter `out` is `None`. |
| 1834 | + Default: "K". |
| 1835 | +Returns: |
| 1836 | + dpnp.ndarray: |
| 1837 | + An array containing the element-wise minima. The data type of |
| 1838 | + the returned array is determined by the Type Promotion Rules. |
| 1839 | +""" |
| 1840 | + |
| 1841 | + |
| 1842 | +maximum_func = BinaryElementwiseFunc( |
| 1843 | + "maximum", |
| 1844 | + ti._maximum_result_type, |
| 1845 | + ti._maximum, |
| 1846 | + _maximum_docstring_, |
| 1847 | +) |
| 1848 | + |
| 1849 | + |
| 1850 | +def dpnp_maximum(x1, x2, out=None, order="K"): |
| 1851 | + """Invokes maximum() from dpctl.tensor implementation for maximum() function.""" |
| 1852 | + |
| 1853 | + # dpctl.tensor only works with usm_ndarray or scalar |
| 1854 | + x1_usm_or_scalar = dpnp.get_usm_ndarray_or_scalar(x1) |
| 1855 | + x2_usm_or_scalar = dpnp.get_usm_ndarray_or_scalar(x2) |
| 1856 | + out_usm = None if out is None else dpnp.get_usm_ndarray(out) |
| 1857 | + |
| 1858 | + res_usm = maximum_func( |
| 1859 | + x1_usm_or_scalar, x2_usm_or_scalar, out=out_usm, order=order |
| 1860 | + ) |
| 1861 | + return dpnp_array._create_from_usm_ndarray(res_usm) |
| 1862 | + |
| 1863 | + |
| 1864 | +_minimum_docstring_ = """ |
| 1865 | +minimum(x1, x2, out=None, order='K') |
| 1866 | +
|
| 1867 | +Compares two input arrays `x1` and `x2` and returns |
| 1868 | +a new array containing the element-wise minima. |
| 1869 | +
|
| 1870 | +Args: |
| 1871 | + x1 (dpnp.ndarray): |
| 1872 | + First input array, expected to have numeric data type. |
| 1873 | + x2 (dpnp.ndarray): |
| 1874 | + Second input array, also expected to have numeric data type. |
| 1875 | + out ({None, dpnp.ndarray}, optional): |
| 1876 | + Output array to populate. |
| 1877 | + Array have the correct shape and the expected data type. |
| 1878 | + order ("C","F","A","K", optional): |
| 1879 | + Memory layout of the newly output array, if parameter `out` is `None`. |
| 1880 | + Default: "K". |
| 1881 | +Returns: |
| 1882 | + dpnp.ndarray: |
| 1883 | + An array containing the element-wise maxima. The data type of |
| 1884 | + the returned array is determined by the Type Promotion Rules. |
| 1885 | +""" |
| 1886 | + |
| 1887 | + |
| 1888 | +minimum_func = BinaryElementwiseFunc( |
| 1889 | + "minimum", |
| 1890 | + ti._minimum_result_type, |
| 1891 | + ti._minimum, |
| 1892 | + _minimum_docstring_, |
| 1893 | +) |
| 1894 | + |
| 1895 | + |
| 1896 | +def dpnp_minimum(x1, x2, out=None, order="K"): |
| 1897 | + """Invokes minimum() from dpctl.tensor implementation for minimum() function.""" |
| 1898 | + |
| 1899 | + # dpctl.tensor only works with usm_ndarray or scalar |
| 1900 | + x1_usm_or_scalar = dpnp.get_usm_ndarray_or_scalar(x1) |
| 1901 | + x2_usm_or_scalar = dpnp.get_usm_ndarray_or_scalar(x2) |
| 1902 | + out_usm = None if out is None else dpnp.get_usm_ndarray(out) |
| 1903 | + |
| 1904 | + res_usm = minimum_func( |
| 1905 | + x1_usm_or_scalar, x2_usm_or_scalar, out=out_usm, order=order |
| 1906 | + ) |
| 1907 | + return dpnp_array._create_from_usm_ndarray(res_usm) |
| 1908 | + |
| 1909 | + |
1816 | 1910 | _multiply_docstring_ = """
|
1817 | 1911 | multiply(x1, x2, out=None, order="K")
|
1818 | 1912 |
|
|
0 commit comments