07 2022 档案

摘要:点击查看代码 import collections import math import torch from torch import nn from d2l import torch as d2l # 实现循环神经网络编码器 #@save class Seq2SeqEncoder(d2l.Enc 阅读全文
posted @ 2022-07-12 13:50 荒北 阅读(57) 评论(0) 推荐(0) 编辑
摘要:数据不在同一设备 将device = d2l.try_gpu() 改为device = torch.device('cpu') 62seq2seq 阅读全文
posted @ 2022-07-06 20:31 荒北 阅读(1314) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 import os import torch from d2l import torch as d2l # 下载和预处理数据集 print('下载数据集') #@save d2l.DATA_HUB['fra-eng'] = (d2l.DATA_URL + 'fra-eng.zip', 阅读全文
posted @ 2022-07-04 15:37 荒北 阅读(151) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 import torch from torch import nn from d2l import torch as d2l # 不能预测未来 # 加载数据 batch_size, num_steps, device = 32, 35, d2l.try_gpu() train_iter 阅读全文
posted @ 2022-07-04 15:17 荒北 阅读(38) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 import torch from torch import nn from d2l import torch as d2l batch_size, num_steps = 32, 35 train_iter, vocab = d2l.load_data_time_machine(ba 阅读全文
posted @ 2022-07-04 15:04 荒北 阅读(24) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 import torch from torch import nn from d2l import torch as d2l batch_size, num_steps = 32, 35 train_iter, vocab = d2l.load_data_time_machine(ba 阅读全文
posted @ 2022-07-04 14:51 荒北 阅读(38) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 import torch from torch import nn from d2l import torch as d2l """ 额外的控制单元 """ batch_size, num_steps = 32, 35 train_iter, vocab = d2l.load_data 阅读全文
posted @ 2022-07-04 14:24 荒北 阅读(46) 评论(0) 推荐(0) 编辑
摘要:点击查看代码 import torch from torch import nn from torch.nn import functional as F from d2l import torch as d2l batch_size, num_steps = 32, 35 train_iter, 阅读全文
posted @ 2022-07-04 13:33 荒北 阅读(39) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示