Skip to content

Questions about Contrastive Loss Function #30

@mxqmxqmxq

Description

@mxqmxqmxq

Great work, simple and efficient! However, I have some doubts about the implementation of the NTXentLoss function. Why is the shape of logits 1024, 1023, while the shape of the labels is 1024? After that, why is a torch.nn.CrossEntropyLoss used? Why is this done this way? Isn't the general implementation simply -log(loss_positive / loss_negative)?
image

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