Open bbernhar opened 1 month ago
@a-sully @RafaelCintron @fdwr @huningxin appreciate any feedback
constant_input
-> constantInput
(🚫🐍).
I'd need more time to think for meaningful feedback, but it may be rather confusing having this list of methods o_o:
graphBuilder.input()
graphBuilder.constant()
graphBuilder.constantInput()
I'd need more time to think for meaningful feedback, but it may be rather confusing having this list of methods o_o:
Thanks for the quick feedback. I simplified the proposal even further via initializer + new usage bit.
Definitely interested in this from the point of view of caching models as well (especially weights that might be used by both WebGPU and WebNN implementations).
Demonstrate how
MLTensor
can be used to help web developers manage constant data (e.g., trained weights) on-device.Dependent PRs
MLConstantOperand
: https://github.com/webmachinelearning/webnn/issues/668#issue-2272156183MLTensor
: https://github.com/webmachinelearning/webnn/pull/754Motivation
Design
MLTensor
containing constant data will be associated by name upon creating theMLOperand
. At build(), the (un-optimized) constant data will be copied into the device. The original constant data (ie.ArrayBuffer
input or uploaded device data held byMLTensor
) can be discarded immediately once writeBuffer() is called and build() succeeds.Example JS
Proposed IDL
Edits:
MLOperandDescriptor
as required byMLOperand