Skip to content

Improve documentation of make_causal_mask #1520

Description

@rongcuid

The current make_causal_mask API is overly restrictive because it requires one to have an array of shape [B, *, L], but MultiHeadAttention requires [B, *, L, H] as input. This causes a great amount of confusion (as the examples do not have shape annotation/comments) when created mask contains features in its shape and cause shape mismatch errors down the road.

I propose to change the make_causal_mask to take a shape tuple as input, instead of an example input array.

As a side issue, many functions have docstrings, but they are not in the generated documents. Most notably are all __call__ methods, which I think are very important. I am unfamiliar with Sphinx, so I am not sure what kind of issue this would be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: P2 - no scheduleBest effort response and resolution. We have no plan to work on this at the moment.Status: pull requests welcomeWe agree with the direction proposed, feel free to give it a shot and file a pull request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions