Skip to content

Need clarify the maximum limit of the hidden size of the Gru operator #625

Description

@miaobin

WebNN defines two parameters bias and recurrent bias for Gru operator. Their shapes are [numDirections, 3 * hiddenSize], but in some backends like DirectML only defines one bias and the shape is [1, 1, numDirections, 6 * hiddenSize] ], 6*hiddenSize needs to be verified at this time.
We are currently validate it in backed side, but in order to avoid surprise build failures for web developers, we hope to validate and throw error in the verification layer. So should this limit be part of the spec and validated for all backends?
Link to chromium CL discussion.

Activity

  1. inexorabletash commented on Apr 17, 2024

    @inexorabletash
    Contributor

    Somewhat related spec issue:

    Currently, the spec validates that 3 * hiddenSize is a valid dimension implicitly by comparing it against bias's and recurrentBias's second dimension. Implicitly, if bias is an MLOperand, then it's dimensions are valid, and so if 3 * hiddenSize is equal to the second dimension then it's also a valid dimension. But if neither bias nor recurrentBias are passed, then no validation is done!

  2. inexorabletash commented on Apr 17, 2024

    @inexorabletash
    Contributor

    This issue seems to apply to lstm as well (chromium impl) - DML takes [1, 1, direction_count, 8 * hidden_size]

    Also, the impl (and thus this issue) applies to gru + gruCell, and lstm + lstmCell

  3. added a commit that references this issue on May 1, 2024
    ecc55a3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions