Skip to content

reduction for ContrastiveLoss #3460

@wyli

Description

@wyli

Describe the bug
the error messages and docstring should be consistent

if self.reduction == LossReduction.SUM.value:
return torch.sum(loss_partial) / (2 * self.batch_size)
raise ValueError(f"Unsupported reduction: {self.reduction}, " f'available options are ["mean", "sum", "none"].')

ValueError: When ``self.reduction`` is not one of ["sum", "none"].

Expected behavior
implementing the option reduction="none"?

Metadata

Metadata

Assignees

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