在进行损失函数计算时 使用交叉熵损失函数
criterion = nn.CrossEntropyLoss(
loss=criterion(logits,label)
报错
RuntimeError: "nll_loss_forward_reduce_cuda_kernel_2d_index" not implemented for 'Int'
或者
RuntimeError: "nll_loss_forward_reduce_cuda_kernel_2d_index" not implemented for 'Float'
这是因为label的数据类型不能为float或者int 需要转化为long
loss=criterion(logits,label.long())