07 2022 档案
摘要:点击查看代码 import collections import math import torch from torch import nn from d2l import torch as d2l # 实现循环神经网络编码器 #@save class Seq2SeqEncoder(d2l.Enc
阅读全文
摘要:数据不在同一设备 将device = d2l.try_gpu() 改为device = torch.device('cpu') 62seq2seq
阅读全文
摘要:点击查看代码 import os import torch from d2l import torch as d2l # 下载和预处理数据集 print('下载数据集') #@save d2l.DATA_HUB['fra-eng'] = (d2l.DATA_URL + 'fra-eng.zip',
阅读全文
摘要:点击查看代码 import torch from torch import nn from d2l import torch as d2l # 不能预测未来 # 加载数据 batch_size, num_steps, device = 32, 35, d2l.try_gpu() train_iter
阅读全文
摘要:点击查看代码 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
阅读全文
摘要:点击查看代码 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
阅读全文
摘要:点击查看代码 import torch from torch import nn from d2l import torch as d2l """ 额外的控制单元 """ batch_size, num_steps = 32, 35 train_iter, vocab = d2l.load_data
阅读全文
摘要:点击查看代码 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,
阅读全文