大马哈鱼的博客


  • 首页

  • 分类

  • 关于

  • 归档

  • 标签

  • 搜索

seq-lstm的实现

发表于 2017-12-13 | 分类于 PyTorch
一句话[‘Everybody’, ‘read’, ‘that’, ‘book’]每次一个词当成一个序列, 只取最终输出,则变为(1,50) 四个词叠加变为(4,50)一句话的输入为[5, 6, 7, 8]经过嵌入层变为(4,100) 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 ...
阅读全文 »

N-Gram模型实现方式

发表于 2017-12-13 | 分类于 PyTorch
N-Gram模型实现方式1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980import torchimport torch.nn.functional as Ffrom torch import nn, optimfrom torch.autograd import VariableCONTEXT_SIZE = 2EMBEDDING_DIM = ...
阅读全文 »

pytorch加载已训练好的word-embedding

发表于 2017-12-12 | 分类于 PyTorch
如果是随机初始化的向量,是这么定义的:1self.word_embeds = nn.Embedding(vocab_size, embedding_dim) 如果pretrained_weight是已经训练好的词向量,加载方式一如下:123self.word_embeds = nn.Embedding(vocab_size, embedding_dim)pretrained_weight = np.array(pretrained_weight)self.embed.weight.data.copy_(torch.from_numpy(pretrained_weight)) https://w ...
阅读全文 »

使用帮助

发表于 2017-12-05
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. 一级标题文档题头1234567---title: Learning PyTorch With Examplesdate: 2017-10-11 19:22:56categories: PyTorchtags: ...
阅读全文 »
李永彬

李永彬

4 日志
1 分类
GitHub CSDN
友情链接
  • NEXT
  • Markdown入门
  • hexo使用技巧
  • 小丁丁
  • 王敏
© 2017 李永彬
由 Hexo 强力驱动
主题 - NexT.Muse    |