Hi,
My training loop looks something like this
loss_fn = nn.BCEWithLogitsLoss()
    for epoch in range(1, num_epochs+1):
        model.train()
        for X, y in train_loader:
            X, y = X.to(device), y.to(device)
            y_hot = F.one_hot(y, num_classes)
            output = model(X)
            optimizer.zero_grad()
            loss = loss_fn(output, y_hot)
            loss.backward()
            optimizer.step()

I am transforming the target to be a one-hot vector as expected by the BCEWithLogitsLoss().
But, I am still getting the following error, pointing at the loss function:
RuntimeError: result type Float can't be cast to the desired output type Long

I can’t really understand the error message. What am I doing wrong?