Skip to content
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

Bug fix: Optional sequences shouldn't be defaulted to null #539

Merged

Conversation

inexorabletash
Copy link
Member

@inexorabletash inexorabletash commented Jan 29, 2024

MLArgMinMaxOptions and MLReduceOptions have an 'axes' member that the IDL declares as defaulting to null. They have type sequence which is not nullable. The intent is that these are optional members with default behavior if not present, which is handled in the algorithm already.

If the desire is to be able to explicitly pass null, the IDL fix would be to make the type nullable: sequence<unsigned long>? axes = null; but that's inconsistent with the rest of the spec and not the convention for optional dictionary members.


Preview | Diff

@inexorabletash inexorabletash changed the title Bug fix: Optional sequences shouldn't be defauled to null Bug fix: Optional sequences shouldn't be defaulted to null Jan 29, 2024
@inexorabletash inexorabletash force-pushed the bugfix-sequence-options-null branch from d2ce8d3 to 65cfca3 Compare January 29, 2024 20:10
@fdwr
Copy link
Collaborator

fdwr commented Feb 1, 2024

Looks right to me. Like you said, the intention is that you may omit optional axes completely in the MLReduceOptions to get a form of "global reduce", which is treated equivalent to having passed all axes (e.g. for 5D, {axes: [0,1,2,3,4]}). Note that complete omission of axes is also distinct from passing an explicitly empty sequence (e.g {axes: [], keepDimensions: true}) which is effectively treated as a nop.

Copy link
Contributor

@huningxin huningxin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

null value doesn't have any semantics for axes, we should remove it.

@inexorabletash inexorabletash force-pushed the bugfix-sequence-options-null branch from 65cfca3 to ef800fb Compare February 6, 2024 18:07
MLArgMinMaxOptions and MLReduceOptions have an 'axes' member that the
IDL declares as defaulting to null. They have type sequence<unsigned
long> which is not nullable. The intent is that these are optional
members with default behavior if not present, which is handled in the
algorithm already.
@inexorabletash inexorabletash force-pushed the bugfix-sequence-options-null branch from ef800fb to 44d5e0b Compare February 7, 2024 17:42
@inexorabletash inexorabletash removed the request for review from wchao1115 February 9, 2024 16:56
@fdwr
Copy link
Collaborator

fdwr commented Feb 9, 2024

Merging this. Chai is on the reviewers list for this CR, but we don't need to wait for his review (after speaking with him, there's a select set of reviews and topics he's interested in, but otherwise he won't be looking at every CR). Thanks Josh.

@fdwr fdwr merged commit bec8e7e into webmachinelearning:main Feb 9, 2024
2 checks passed
@inexorabletash inexorabletash deleted the bugfix-sequence-options-null branch February 9, 2024 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants