标签:pytorch

你正在查看标签『pytorch』下的文章

Attention模型构建(pytorch)

介绍完seq2seq+attention(Simple to seq2seq And attention | Ripshun Blog),我们来构建一个用pytorch写的模型. 第一步:构建Encoder: 代码: class encode(nn.Module): def __init__(self): super(encode,self).__init__() self.embedd = nn.Embedding(dic_num,dim_num) self.gru = nn.GRU(dim_num,hid_dim_num,num_layers,bidirectional=True) ...