Python PyTorch 中使用 topk 函数获取 softmax 输出的前 k 个元素
L1 = [] L2 = [] s1, s2 = torch.topk(torch.softmax(output, dim=1), k=3) 将 s1,s2 放入列表中
L1.append(s1) L2.append(s2)
原文地址: https://www.cveoy.top/t/topic/qfUm 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
L1 = [] L2 = [] s1, s2 = torch.topk(torch.softmax(output, dim=1), k=3) 将 s1,s2 放入列表中
L1.append(s1) L2.append(s2)
原文地址: https://www.cveoy.top/t/topic/qfUm 著作权归作者所有。请勿转载和采集!