nn import functional as F from d2l import torch as d2l batch_size, num_steps = 32, 35 train_iter, vocab = d2l.load_data_time_machine(batch_size, num_steps) 定义模型 代码语言:javascript 复制 num_hiddens = 256 rnn_layer = nn.RNN(len(vocab), num_hiddens) 隐状态:(隐藏层数,批量大小,...