摘要:
1 import torch 2 from torch import nn, optim 3 from torch.autograd import Variable 4 import torch.nn.functional as F 5 6 CONTEXT_SIZE = 2 # 2 words to the left, 2 to the right 7 raw_text = "... 阅读全文
摘要:
1 import torch 2 import torch.nn as nn 3 from torch.autograd import Variable 4 import torch.nn.functional as F 5 import torch.optim as optim 6 7 CONTEXT_SIZE = 2 # the same as wind... 阅读全文
摘要:
1 import torch 2 import torch.nn as nn 3 from torch.autograd import Variable 4 5 word2id = {'hello': 0, 'world': 1} 6 # you have 2 words, and then need 5 dim each word 7 embeds = nn.Embedding... 阅读全文