nlp
zzhuao
cs小白,摸索中学习。
展开
-
{RuntimeError}Tensor for argument #3 ‘mat2‘ is on CPU, but expected it to be on GPU 问题解决
cpu gpu原创 2022-07-26 11:51:13 · 3431 阅读 · 1 评论 -
sample pairs 用于contrastiveLoss, CosinembeddingLoss等配对
def x1, x2, target = sample_pair(label, emb_vec)label: [1,1,2,3,4…,1] #64emb_vec: word embedding 或者 hidden feature 等 看是要feature learning还是embedding learning #tensor [64,300]代码内部参数:r_idx: [[0,0,…0], [1,1…,1],…[63,63…63]] #[64,64]c_idx=[[0,1,2…63],…原创 2021-11-01 11:02:04 · 201 阅读 · 0 评论