📜  什么是 pytorch 示例中的交叉熵损失 - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:17.229000             🧑  作者: Mango

代码示例1
>>> loss = nn.CrossEntropyLoss()
>>> input = torch.randn(3, 5, requires_grad=True)
>>> target = torch.empty(3, dtype=torch.long).random_(5)
>>> output = loss(input, target)
>>> output.backward()