For gru()/gruCell() and lstm()/lstmCell(), a hiddenSize parameter is passed, a multiple of which defines a dimension of the output.
This is sometimes implicitly validated by the presence of an option with the same dimension - but not always.
Some underlying platforms operate on a single bias tensor, rather than the two bias/recurrentBias options present in the WebNN API. So the combined size needs to also be a valid dimension.
Introduce validation for all cases, validate the combined size, and add an explanation inline since this is subtle.
For gru()/gruCell() and lstm()/lstmCell(), a hiddenSize parameter is passed, a multiple of which defines a dimension of the output.
This is sometimes implicitly validated by the presence of an option with the same dimension - but not always.
Some underlying platforms operate on a single bias tensor, rather than the two bias/recurrentBias options present in the WebNN API. So the combined size needs to also be a valid dimension.
Introduce validation for all cases, validate the combined size, and add an explanation inline since this is subtle.
Fixes #625
Preview | Diff