I have created custom dataset in pytorch. I passed custom dataset object to dataloader. Train and validation dataloader objects passed to fastai databunch.
data = DataBunch(train_dataloader, validation_dataloader)
I am using loss_function = torch.nn.BCEWithLogitsLoss()
loss function expecting target should be float. So I am passing input & target as float to the model.
learn = Learner(data,model.cuda(),opt_func=opt_func,loss_func=loss_func, metrics=error_rate)
I am getting error while learn.fit_one_cycle(20,max_lr=1e-02,pct_start=0.3) . Expected object of scalar type Long but got scalar type Float for argument #2 'other’
Now what i understood is i should pass target as float for loss calculation and for accuracy calculation i should pass target as long. Help me to do this