BCEWithLogitsLoss
BCEWithLogitsLoss报错RuntimeError: result type Float can't be cast to the desired output type Long
loss = F.binary_cross_entropy_with_logits(input, target) input错写成了Long类型,target错写成了Int类型 input与target需要的是float类型 ......
实例解释BCELoss与BCEWithLogitsLoss的关联(二分类问题)
BCEWithLogitsLoss = Sigmoid + BCELoss, nn接口 Function接口 nn.BCELoss( ) F.binary_cross_entropy( ) nn.BCEWithLogitsLoss( ) F.binary_cross_entropy_with_log ......