@ptrblck my target contains 0 and 1 and i solved above problem with nn.BCEWithLogitsLoss instead of  CrossEntropyLoss but my 2nd problem is during inference,i still get the same error while inferencing or making prediction using this model,please help with 2nd part of this post,thanks