Skip to content

Commit 751926b

Browse files
committed
impl_minimum_maximum_elementwise_funcs
1 parent 79994c1 commit 751926b

File tree

14 files changed

+1335
-7
lines changed

14 files changed

+1335
-7
lines changed

dpctl/tensor/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@
134134
logical_not,
135135
logical_or,
136136
logical_xor,
137+
maximum,
138+
minimum,
137139
multiply,
138140
negative,
139141
not_equal,
@@ -271,6 +273,8 @@
271273
"log1p",
272274
"log2",
273275
"log10",
276+
"maximum",
277+
"minimum",
274278
"multiply",
275279
"negative",
276280
"not_equal",

dpctl/tensor/_elementwise_funcs.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,66 @@
11471147
_logical_xor_docstring_,
11481148
)
11491149

1150+
# B??: ==== MAXIMUM (x1, x2)
1151+
_maximum_docstring_ = """
1152+
maximum(x1, x2, out=None, order='K')
1153+
1154+
Compares two input arrays `x1` and `x2` and returns
1155+
a new array containing the element-wise maxima.
1156+
1157+
Args:
1158+
x1 (usm_ndarray):
1159+
First input array, expected to have numeric data type.
1160+
x2 (usm_ndarray):
1161+
Second input array, also expected to have numeric data type.
1162+
out ({None, usm_ndarray}, optional):
1163+
Output array to populate.
1164+
Array have the correct shape and the expected data type.
1165+
order ("C","F","A","K", optional):
1166+
Memory layout of the newly output array, if parameter `out` is `None`.
1167+
Default: "K".
1168+
Returns:
1169+
usm_narray:
1170+
An array containing the element-wise products. The data type of
1171+
the returned array is determined by the Type Promotion Rules.
1172+
"""
1173+
maximum = BinaryElementwiseFunc(
1174+
"maximum",
1175+
ti._maximum_result_type,
1176+
ti._maximum,
1177+
_maximum_docstring_,
1178+
)
1179+
1180+
# B??: ==== MINIMUM (x1, x2)
1181+
_minimum_docstring_ = """
1182+
minimum(x1, x2, out=None, order='K')
1183+
1184+
Compares two input arrays `x1` and `x2` and returns
1185+
a new array containing the element-wise minima.
1186+
1187+
Args:
1188+
x1 (usm_ndarray):
1189+
First input array, expected to have numeric data type.
1190+
x2 (usm_ndarray):
1191+
Second input array, also expected to have numeric data type.
1192+
out ({None, usm_ndarray}, optional):
1193+
Output array to populate.
1194+
Array have the correct shape and the expected data type.
1195+
order ("C","F","A","K", optional):
1196+
Memory layout of the newly output array, if parameter `out` is `None`.
1197+
Default: "K".
1198+
Returns:
1199+
usm_narray:
1200+
An array containing the element-wise minima. The data type of
1201+
the returned array is determined by the Type Promotion Rules.
1202+
"""
1203+
minimum = BinaryElementwiseFunc(
1204+
"minimum",
1205+
ti._minimum_result_type,
1206+
ti._minimum,
1207+
_minimum_docstring_,
1208+
)
1209+
11501210
# B19: ==== MULTIPLY (x1, x2)
11511211
_multiply_docstring_ = """
11521212
multiply(x1, x2, out=None, order='K')

0 commit comments

Comments
 (0)