pytorch
知吾不知
这个作者很懒,什么都没留下…
展开
-
torchtext 读取train_iter是出现AttributeError: ‘Field‘ object has no attribute ‘vocab‘
出现这个错误的原因是声明Field时,要将sequential=True即可。原创 2021-10-14 15:48:42 · 1340 阅读 · 0 评论 -
torchtext错误“Python int too large to convert to C long”
在使用torchtext时 遇到的问题:导致问题原因是:pytorch 与 torchtext 版本的不兼容解决办法:使用可相互兼容的例子:我使用的环境为pytorch 1.1.0,torchtext 0.3.1可正常使用安装指定torchtext指定版本的方法:pip install torchtext == 0.3.1...原创 2019-12-13 14:44:40 · 836 阅读 · 1 评论 -
pytorch入门程序1
一、构建三层神经分类网络输入维度为1000,隐藏层为100维,输出层为10维。激活函数使用ReLU函数,本程序的写法有两个,为了对比体现,现贴出两个的代码,供对比学习。1、使用Sequential构建神经网络import torch#N为一个batch_sizeN,D_in,H,D_out=64,1000,100,10x=torch.randn(N,D_in)y=torch...原创 2019-12-13 14:26:46 · 353 阅读 · 0 评论