RuntimeError: _th_exp_out not supported on CUDAType for Long
Questions and Help
I'm trying to finetune a transformer model for question answering, and am using the BCEWithLogitsLoss function.
However when I try calculating loss i get this error:

RuntimeError: _th_exp_out not supported on CUDAType for Long

I'm inputting matrices with the shape and dtype of [16, 2] and Long
Bud sadly I've no idea to solve this. I tried using another dtype (int32, float32, double), which didn't work.
Here is the code:
def loss_fn(self, preds, labels):
    return torch.nn.BCEWithLogitsLoss()(preds, labels)

def train_fn(self, dataloader, model, optimizer, device):
    # Some other stuff here
    pred = model(
            token_ids = token_ids,
            attention_mask = attention_mask,
            token_type_ids = token_type_ids)
    start_scores = torch.argmax(pred[0], dim=1)
    end_scores = torch.argmax(pred[1], dim=1)
        
    pred = torch.tensor(list(zip(start_scores, end_scores)))
    pred = pred.to(device, dtype=torch.long)

    batch_loss = self.loss_fn(pred, label)


Passing both, pred and label as float worked in my case.
