Skip to content

fix ops.max #1993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions mindnlp/core/ops/reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,20 @@ def max(*args, **kwargs):
if use_pyboost() and has_max:
return mindspore.mint.max(*args, **kwargs)

input = kwargs.get('input', None) or args[0]
dim = kwargs.get('dim', None) or args[1]
keepdim = kwargs.get('keepdim', False) or args[2]
input = kwargs.get('input', None)
dim = kwargs.get('dim', None)
keepdim = kwargs.get('keepdim', False)
if len(args) == 1:
input = args[0]
elif len(args) == 2:
input = args[0]
dim = args[1]
elif len(args) == 3:
input = args[0]
dim = args[1]
keepdim = args[2]
else:
raise RuntimeError(f'need 3 inputs but got {len(args)}')
out = ops.max(input, dim, keepdim)
if dim is None:
return out[0]
Expand Down
Loading