[英]How do I represent a PyTorch LSTM 3D Tensor?
根據文檔,我看到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])
。 我希望以某種方式需要第三維,但我不確定它的實際含義。 任何幫助將不勝感激。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.