English 中文(简体)
了解最不发达等国家产出与隐藏的国家产出之间的区别
原标题:Understanding the Distinction Between LSTM Output and Hidden State Output
  • 时间:2022-03-19 22:57:23
  •  标签:
  • pytorch
  • lstm

目前,我正在为我的助手开发一个警钟模型,我正面临一个两难局面,即我应该把这一结果纳入我的线性界。 是否可以澄清两个现有产出之间的区别,并深入了解为什么应当考虑提出选择的具体建议?

谢谢!

问题回答

You should give the output to the linear layer instead of hidden state output. Like this (time series prediction):

def forward(self, input_seq):
    h_0 = torch.randn(self.num_directions * self.num_layers, self.batch_size, self.hidden_size).to(device)
    c_0 = torch.randn(self.num_directions * self.num_layers, self.batch_size, self.hidden_size).to(device)
    seq_len = input_seq.shape[1]
    input_seq = input_seq.view(self.batch_size, seq_len, 1)
    output, _ = self.lstm(input_seq, (h_0, c_0))
    output = output.contiguous().view(self.batch_size * seq_len, self.hidden_size)
    pred = self.linear(output)
    pred = pred.view(self.batch_size, seq_len, -1)
    pred = pred[:, -1, :]
    return pred

产出中包含最后一级所有阶段的暗藏国家产出,而隐藏的国家产出只是最后一步的秘密国家。





相关问题
How to process large dataset in pytorch DDP mode?

I have a large Dataset about 900G. The memory of my machine is 1T. I want to train a model in distributed training mode. I have 10 gpus. I used to use tensorflow and horovod to make it. I split the ...

Tensorflow cannot detect CUDA enabled device

I have an RTX 4070 on my Dell XPS laptop that also comes with an Intel IRIS Xe Graphics card. I am using Windows 11. I have NVIDIA Graphics Driver Version 535.98 installed on my system and has support ...

No module named mmcv._ext

Tried to train the model but got the mmcv error No module named mmcv._ext mmcv library is already installed and imported mmcv version = 1.4.0 Cuda version = 10.0 Any suggestions to fix the issue??

热门标签