02 2022 档案

摘要:参考博客 阅读全文
posted @ 2022-02-23 16:46 zae 阅读(53) 评论(0) 推荐(0) 编辑
摘要:csdn CrossEntropyLoss 等价于 softmax+log+NLLLoss LogSoftmax等价于softmax+log # 首先定义该类 loss = torch.nn.CrossEntropyLoss() #然后传参进去 loss(input, target) input维度 阅读全文
posted @ 2022-02-23 00:15 zae 阅读(136) 评论(0) 推荐(0) 编辑
摘要:label_to_id: B-LOC 0 B-ORG 1 B-PER 2 I-LOC 3 I-ORG 4 I-PER 5 O 6 dict->txt with open('data/label_dict.txt', 'w') as dict_f: for k, v in label_to_id.it 阅读全文
posted @ 2022-02-22 22:57 zae 阅读(554) 评论(0) 推荐(0) 编辑
摘要:logit[2,3] tensor(0.6992, device='cuda:0', grad_fn=<SelectBackward>) logit[[2,3]] tensor([[ 0.0344, -0.3932, -0.1510, 0.6992, -0.1125, 0.1510, -0.1140 阅读全文
posted @ 2022-02-22 22:37 zae 阅读(233) 评论(0) 推荐(0) 编辑
摘要:讲解 对比学习论文中出现: # compute logits # Einstein sum is more intuitive # positive logits: Nx1 l_pos = torch.einsum('nc,nc->n', [q, k]).unsqueeze(-1) # negati 阅读全文
posted @ 2022-02-22 20:27 zae 阅读(662) 评论(0) 推荐(0) 编辑
摘要:取参数: g=model.named_parameters() parm={} for name,parameters in model.named_parameters(): print(name,':',parameters.size()) parm[name]=parameters.detac 阅读全文
posted @ 2022-02-22 11:00 zae 阅读(514) 评论(0) 推荐(0) 编辑
摘要:parser.add_argument("--flag", action="store_true", help="Run or not.") 当你不输入 --flag 的时候,默认为 False;输入 --flag 的时候,才会触发 True 值。【符合常理】 当然用方式,反过来也可以指定 acti 阅读全文
posted @ 2022-02-22 09:31 zae 阅读(878) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示