-
Notifications
You must be signed in to change notification settings - Fork 47
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
Use AllowSharedBufferSource
for MLGraphBuilder.constant()
#790
base: main
Are you sure you want to change the base?
Use AllowSharedBufferSource
for MLGraphBuilder.constant()
#790
Conversation
@a-sully , PTAL? |
@@ -1503,9 +1504,6 @@ Build a composed graph up to a given output operand into a computational graph a | |||
1. Set |graph|.{{MLGraph/[[context]]}} to [=this=].{{MLGraphBuilder/[[context]]}}. | |||
1. [=set/For each=] |operand| in |inputs|: | |||
1. Set |graph|.{{MLGraph/[[inputDescriptors]]}}[|operand|.{{MLOperand/[[name]]}}] to |operand|.{{MLOperand/[[descriptor]]}}. | |||
|
|||
Issue(566): If {{MLGraphBuilder/constant(descriptor, bufferView)|constants'}} {{ArrayBuffer}}s are not [=ArrayBuffer/transferred=], make copies for [=MLGraphBuilder/graph=]'s [=computational graph/constants=] here. |
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.
Note: this issue is closed and not relevant.
</summary> | ||
1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. | ||
1. If [=MLOperandDescriptor/checking dimensions=] given |descriptor| returns false, then [=exception/throw=] a {{TypeError}}. | ||
1. If [=validating buffer with descriptor=] given |bufferView| and |descriptor| returns false, then [=exception/throw=] a {{TypeError}}. | ||
1. If [=validating buffer with descriptor=] given |bufferSource| and |descriptor| returns false, then [=exception/throw=] a {{TypeError}}. |
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.
Note: This depends on #787 for supporting AllowSharedBufferSource
in "validate buffer with descriptor" algorithm.
MLGraphBuilder.constant()
AllowSharedBufferSource
for MLGraphBuilder.constant()
@@ -1341,7 +1341,8 @@ interface MLGraphBuilder { | |||
MLOperand input(USVString name, MLOperandDescriptor descriptor); | |||
|
|||
// Create an operand for a graph constant. | |||
MLOperand constant(MLOperandDescriptor descriptor, ArrayBufferView bufferView); | |||
MLOperand constant(MLOperandDescriptor descriptor, | |||
AllowSharedBufferSource bufferSource); |
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.
What do you think about just using buffer
, at least in the IDL?
AllowSharedBufferSource bufferSource); | |
AllowSharedBufferSource buffer); |
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.
LGTM!
Fix #788
Preview | Diff