Batch size for LSTM - PyTorch Forums
https://discuss.pytorch.org/t/batch-size-for-lstm/4761911.06.2019 · I am working on an encoder that uses LSTM def init_hidden(self, batch): ''' used to initialize the encoder (LSTMs) with number of layers, batch_size and hidden layer dimensions :param batch: batch size :return: ''' return ( torch.zeros(self.num_layers, batch, self.h_dim).cuda(), torch.zeros(self.num_layers, batch, self.h_dim).cuda() ) this is the code to initialize the LSTM, …