Pytorch详解NLLLoss和CrossEntropyLoss、以及softmax和log_softmax
数据importtorchimporttorch.nn.functionalasFimportnumpyasnp#随机新建3个样例数据,每个样例数据包含4个属性特征input=torch.randn(3,4)tensor([[0.0054,-0.8030,-0.5758,-0.6518],[-0.5518,0.3904,0.5296,0.4973],[0.1608,0.5822,0.9536,-0