Skip to content

Commit ef7ad7a

Browse files
committed
Add maximum and minimum torch wrappers (for fixed two-arg type promotion)
1 parent 198d6d7 commit ef7ad7a

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

array_api_compat/torch/_aliases.py

+13-10
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ def can_cast(from_: Union[Dtype, array], to: Dtype, /) -> bool:
177177
logaddexp = _two_arg(torch.logaddexp)
178178
# logical functions are not included here because they only accept bool in the
179179
# spec, so type promotion is irrelevant.
180+
maximum = _two_arg(torch.maximum)
181+
minimum = _two_arg(torch.minimum)
180182
multiply = _two_arg(torch.multiply)
181183
not_equal = _two_arg(torch.not_equal)
182184
pow = _two_arg(torch.pow)
@@ -735,15 +737,16 @@ def sign(x: array, /) -> array:
735737
'atan2', 'bitwise_and', 'bitwise_left_shift', 'bitwise_or',
736738
'bitwise_right_shift', 'bitwise_xor', 'copysign', 'divide',
737739
'equal', 'floor_divide', 'greater', 'greater_equal', 'hypot',
738-
'less', 'less_equal', 'logaddexp', 'multiply', 'not_equal', 'pow',
739-
'remainder', 'subtract', 'max', 'min', 'clip', 'unstack',
740-
'cumulative_sum', 'sort', 'prod', 'sum', 'any', 'all', 'mean',
741-
'std', 'var', 'concat', 'squeeze', 'broadcast_to', 'flip', 'roll',
742-
'nonzero', 'where', 'reshape', 'arange', 'eye', 'linspace', 'full',
743-
'ones', 'zeros', 'empty', 'tril', 'triu', 'expand_dims', 'astype',
744-
'broadcast_arrays', 'UniqueAllResult', 'UniqueCountsResult',
745-
'UniqueInverseResult', 'unique_all', 'unique_counts',
746-
'unique_inverse', 'unique_values', 'matmul', 'matrix_transpose',
747-
'vecdot', 'tensordot', 'isdtype', 'take', 'sign']
740+
'less', 'less_equal', 'logaddexp', 'maximum', 'minimum',
741+
'multiply', 'not_equal', 'pow', 'remainder', 'subtract', 'max',
742+
'min', 'clip', 'unstack', 'cumulative_sum', 'sort', 'prod', 'sum',
743+
'any', 'all', 'mean', 'std', 'var', 'concat', 'squeeze',
744+
'broadcast_to', 'flip', 'roll', 'nonzero', 'where', 'reshape',
745+
'arange', 'eye', 'linspace', 'full', 'ones', 'zeros', 'empty',
746+
'tril', 'triu', 'expand_dims', 'astype', 'broadcast_arrays',
747+
'UniqueAllResult', 'UniqueCountsResult', 'UniqueInverseResult',
748+
'unique_all', 'unique_counts', 'unique_inverse', 'unique_values',
749+
'matmul', 'matrix_transpose', 'vecdot', 'tensordot', 'isdtype',
750+
'take', 'sign']
748751

749752
_all_ignore = ['torch', 'get_xp']

0 commit comments

Comments
 (0)