Skip to content

Cannot replicate example on MultiLabelAUCMLoss #68

Closed
@Innoversa

Description

@Innoversa

Dear developers of LibAUC,
Thank you for open-sourcing your wonderful work! As I utilize the package's MultilabelAUCLoss for my multi-label classification task, I keep encountering an error: "IndexError: too many indices for tensor of dimension 1". I encounter the same error when running the provided example on the website:

loss_fn = MultiLabelAUCMLoss(margin=1.0, num_labels=10)
y_pred = torch.randn(32, 10, requires_grad=True)
y_true = torch.empty(32, dtype=torch.long).random_(2)
loss = loss_fn(y_pred, y_true)

I couldn't find more concrete examples regarding multi-label problems, I also tried to a few debuggings, including reshaping y_true to (32, 1), send all of them into the same device. However, I've yet figured out how to feed the correct shapes to the loss.
My specific problem involves calculating loss between pred=(batch, 3) and label=(batch) for a 3-class classification.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions