You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i am trying to use the BCEWithLogitsLossFlat(pos_weight=dls.train.cws) in my dataset(2 classes). I am getting the following error after passing the class weights to the loss function:
ValueError: Target size (torch.Size([128])) must be the same as input size (torch.Size([128, 2]))
The error code is:
learn = Learner(dls, model, metrics=accuracy, opt_func=Adam, loss_func=BCEWithLogitsLossFlat(pos_weight=dls.train.cws))
learn.lr_find()
Notably, the same error was reported when I tried to reproduce tutorial file '01a_Multi-class classification'. This is a 6-categorization problem.
ValueError: Target size (torch.Size([384])) must be the same as input size (torch.Size([2304]))
The error code is:
learn = ts_learner(dls, metrics=accuracy) # == ts_learner(dls, arch=InceptionTimePlus, metrics=accuracy) since InceptionTimePlus is the default arch
learn.lr_find()
I would appreciate your help in checking what is causing this. Looking forward to your reply.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
i am trying to use the BCEWithLogitsLossFlat(pos_weight=dls.train.cws) in my dataset(2 classes). I am getting the following error after passing the class weights to the loss function:
ValueError: Target size (torch.Size([128])) must be the same as input size (torch.Size([128, 2]))
The error code is:
learn = Learner(dls, model, metrics=accuracy, opt_func=Adam, loss_func=BCEWithLogitsLossFlat(pos_weight=dls.train.cws))
learn.lr_find()
Notably, the same error was reported when I tried to reproduce tutorial file '01a_Multi-class classification'. This is a 6-categorization problem.
ValueError: Target size (torch.Size([384])) must be the same as input size (torch.Size([2304]))
The error code is:
learn = ts_learner(dls, metrics=accuracy) # == ts_learner(dls, arch=InceptionTimePlus, metrics=accuracy) since InceptionTimePlus is the default arch
learn.lr_find()
I would appreciate your help in checking what is causing this. Looking forward to your reply.
Beta Was this translation helpful? Give feedback.
All reactions