Skip to content

Commit c7194f0

Browse files
committed
impl_minimum_maximum_elementwise_funcs
1 parent aa7de12 commit c7194f0

File tree

14 files changed

+1331
-7
lines changed

14 files changed

+1331
-7
lines changed

dpctl/tensor/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@
128128
logical_not,
129129
logical_or,
130130
logical_xor,
131+
maximum,
132+
minimum,
131133
multiply,
132134
negative,
133135
not_equal,
@@ -257,6 +259,8 @@
257259
"log1p",
258260
"log2",
259261
"log10",
262+
"maximum",
263+
"minimum",
260264
"multiply",
261265
"negative",
262266
"not_equal",

dpctl/tensor/_elementwise_funcs.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,66 @@
969969
_logical_xor_docstring_,
970970
)
971971

972+
# B??: ==== MAXIMUM (x1, x2)
973+
_maximum_docstring_ = """
974+
maximum(x1, x2, out=None, order='K')
975+
976+
Compares two input arrays `x1` and `x2` and returns
977+
a new array containing the element-wise maxima.
978+
979+
Args:
980+
x1 (usm_ndarray):
981+
First input array, expected to have numeric data type.
982+
x2 (usm_ndarray):
983+
Second input array, also expected to have numeric data type.
984+
out ({None, usm_ndarray}, optional):
985+
Output array to populate.
986+
Array have the correct shape and the expected data type.
987+
order ("C","F","A","K", optional):
988+
Memory layout of the newly output array, if parameter `out` is `None`.
989+
Default: "K".
990+
Returns:
991+
usm_narray:
992+
An array containing the element-wise products. The data type of
993+
the returned array is determined by the Type Promotion Rules.
994+
"""
995+
maximum = BinaryElementwiseFunc(
996+
"maximum",
997+
ti._maximum_result_type,
998+
ti._maximum,
999+
_maximum_docstring_,
1000+
)
1001+
1002+
# B??: ==== MINIMUM (x1, x2)
1003+
_minimum_docstring_ = """
1004+
minimum(x1, x2, out=None, order='K')
1005+
1006+
Compares two input arrays `x1` and `x2` and returns
1007+
a new array containing the element-wise minima.
1008+
1009+
Args:
1010+
x1 (usm_ndarray):
1011+
First input array, expected to have numeric data type.
1012+
x2 (usm_ndarray):
1013+
Second input array, also expected to have numeric data type.
1014+
out ({None, usm_ndarray}, optional):
1015+
Output array to populate.
1016+
Array have the correct shape and the expected data type.
1017+
order ("C","F","A","K", optional):
1018+
Memory layout of the newly output array, if parameter `out` is `None`.
1019+
Default: "K".
1020+
Returns:
1021+
usm_narray:
1022+
An array containing the element-wise minima. The data type of
1023+
the returned array is determined by the Type Promotion Rules.
1024+
"""
1025+
minimum = BinaryElementwiseFunc(
1026+
"minimum",
1027+
ti._minimum_result_type,
1028+
ti._minimum,
1029+
_minimum_docstring_,
1030+
)
1031+
9721032
# B19: ==== MULTIPLY (x1, x2)
9731033
_multiply_docstring_ = """
9741034
multiply(x1, x2, out=None, order='K')

0 commit comments

Comments
 (0)