Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add axis argument to softmax() #649
Add axis argument to softmax() #649
Changes from 5 commits
87f3e1f
d022427
8334919
99e8773
66bf64a
ab22738
7f33acc
1877f2e
3e0c670
eb1233b
216c9bb
7981fa5
7a2ef03
622ce75
6ce0fd3
ac5dc3f
b80b0b8
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
axis
needs to be validated according to input's rank.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added for the operator version in 99e8773
For the activation version - would that be done synchronously when the activation is provided in a graph builder call, or at build time? Do we have other cases of activation validation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the information should be available at construction time (pre-
build
), since WebNN requires explicit shapes during construction.None come to mind, except possibly softplus steepness, but that's not impacted by the tensor shape constraints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. In particular, I suppose the validation should be done at the build method of operators that accept a fused activation function, like conv2d.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a sketch of what this could look like:
MLActivation
, add optional validation steps parameter, store the validation steps in an internal slot. The default validation steps are to return true.TypeError
.Thoughts:
MLOperand
in addition to or instead ofMLGraphBuilder
.MLOperand
(i.e. input) sufficient for validation?WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it should pass output MLOperand since the activation follows the operator that fuses it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we'll need to pass the output descriptor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, since stand-alone activations adopt whatever the size is of the operator they are joined to or used inside. So full validation must be deferred for these.
Sounds fine, the MLActivation and at least either the
MLOperand.shape()
or theMLOperand
itself for more generality.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay - 7981fa5 sketches out the validation. Notes:
MLOperandDescriptor
, because earlier we decided that we'd do all validation before creating the operator and outputMLOperand
to pass.