webmachinelearning / webnn

🧠 Web Neural Network API
https://www.w3.org/TR/webnn/
Other
397 stars 48 forks source link

prelu steps should validate the data type of slope is equal to the data type of input #660

Closed huningxin closed 7 months ago

huningxin commented 7 months ago

Raised by @a-sully in Chromium CL review

The spec algorithms for most operators check that the input data type is some given type before checking that other parameters use the same data type. See e.g. matmul:

If a’s dataType is not "float32" or "float16", then throw a TypeError. If b’s dataType is not equal to a’s dataType, then throw a TypeError.

prelu doesn't have the latter step, which seems like a bug in the spec?