好的,下面是使用Python 3.7 和 PyTorch 实现一个LSTM多对一模型的代码:
import torch
import torch.nn as nn
class LSTM(nn.Module):
def __init__(self, input_size, hidden_size, num_layers, output_size):
super(LSTM, self).__init__()
self.hidden_size = hidden_size
self.num_layers = num_lay