【发布时间】:2020-05-26 09:17:00
【问题描述】:
根据the docs,我看到Pytorch’s LSTM expects all of its inputs to be 3D tensors. 我正在尝试做一个简单的序列到序列LSTM,我有:
class BaselineLSTM(nn.Module):
def __init__(self):
super(BaselineLSTM, self).__init__()
self.lstm = nn.LSTM(input_size=100, hidden_size=100)
def forward(self, x):
print('x', x)
x = self.lstm(x)
return x
我的x.size() 是torch.Size([100, 1])。我希望以某种方式需要第三个维度,但我不确定它的实际含义。任何帮助将不胜感激。
【问题讨论】:
标签: python pytorch lstm tensor