Skip to content

Bug fix: Fix MLGraphBuilder.input()'s handling of scalars - #575

Merged
fdwr merged 9 commits into
webmachinelearning:mainfrom
inexorabletash:bugfix-input-dimensions
Feb 21, 2024
Merged

fdwr merged 9 commits into
webmachinelearning:mainfrom
inexorabletash:bugfix-input-dimensions

Conversation

@inexorabletash

@inexorabletash inexorabletash commented Feb 16, 2024 •

Copy link
Copy Markdown
Contributor

MLOperandDescriptor was updated in c320472 to always have dimensions, defaulted to an empty list for scalars. That makes the current prose for input() incorrect. Issue #502 already tracked correcting it, so let's simplify - just change the logic for "is a scalar?" and drop the bogus assert. The "check dimensions" algorithm is streamlined, and constant()'s use is also simplified.

Fixes #502


Preview | Diff

MLOperandDescriptor was updated in c320472 to always have dimensions,
defaulted to an empty list for scalars. That makes the current prose
for input() incorrect. Issue #502 already tracked correcting it, so
let's simplify - just change the logic for "is a scalar?" and drop the
bogus assert.
Comment thread index.bs Outdated
Comment thread index.bs Outdated

@fdwr fdwr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

馃憤 Ningxin said he'd be back next week if you can wait a little longer (I don't want to complete too many CR's without my editorial partner 馃槄), but LGTM.

Comment thread index.bs Outdated

@huningxin huningxin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The fix of MLGraphBuilder.input() LGTM, thanks!

Just left a comment for check dimensions algorithm, I am fine we fix it in a separate PR.

Comment thread index.bs Outdated
Comment thread index.bs Outdated
@inexorabletash

Copy link
Copy Markdown
Contributor Author

At the risk of scope creep: Editors, what do you think of moving the definition of check dimensions either (1) into MLOperandDescriptor, adjacent to byte length, or (2) into Algorithms? With the PR as-is, putting it in with MLOperandDescriptor might be preferred

@huningxin huningxin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks much!

Comment thread index.bs
@inexorabletash inexorabletash changed the title Bug fix: Fix MLGraphBuilder.input()'s handling of scalars. Fixes #502 Bug fix: Fix MLGraphBuilder.input()'s handling of scalars Feb 21, 2024
@inexorabletash

Copy link
Copy Markdown
Contributor Author

LGTM thanks @fdwr !

@fdwr
fdwr merged commit 6e99b01 into webmachinelearning:main Feb 21, 2024
@inexorabletash
inexorabletash deleted the bugfix-input-dimensions branch February 21, 2024 23:24
github-actions Bot added a commit that referenced this pull request Feb 21, 2024
SHA: 6e99b01
Reason: push, by fdwr

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

@huningxin huningxin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The latest change LGTM, thanks @fdwr !

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.

Convert "If descriptor.dimensions does not exist, then descriptor defines a scalar input." from assertion to note

3 participants