Skip to content

Critical bug in the implementation of the PositionalEncoding class #20

@Shahdsaf

Description

@Shahdsaf

Hi,

many thanks for your amazing work and open-sourcing the code. While using and experimenting with the codebase, I found a critical bug in the PositionalEncoding class implementation ([here])(https://github.com/DiffPoseTalk/DiffPoseTalk/blob/main/models/common.py#L22).

The bugged line is:
x = x + self.pe[:, x.shape[1], :]

and the corrected version is:
x = x + (self.pe[:, :x.shape[1], :]).requires_grad(False)

As you can see, the bug happens when adding the encodings of the first x.shape[1] elements but for that to happen we need the slicing which was missing, leading to adding only one PE to all the input sequence elements which corresponds to position x.shape[1].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions