Spaces:
Sleeping
Sleeping
File size: 259 Bytes
4687353 | 1 2 3 4 5 6 7 8 9 | from __future__ import annotations
import torch
def bce_logits_loss(logits: torch.Tensor, targets: torch.Tensor, pos_weight: torch.Tensor) -> torch.Tensor:
loss_fn = torch.nn.BCEWithLogitsLoss(pos_weight=pos_weight)
return loss_fn(logits, targets)
|