PyTorch - How to deactivate dropout in evaluation mode
问题 This is the model I defined it is a simple lstm with 2 fully connect layers. import copy import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim class mylstm(nn.Module): def __init__(self,input_dim, output_dim, hidden_dim,linear_dim): super(mylstm, self).__init__() self.hidden_dim=hidden_dim self.lstm=nn.LSTMCell(input_dim,self.hidden_dim) self.linear1=nn.Linear(hidden_dim,linear_dim) self.linear2=nn.Linear(linear_dim,output_dim) def forward(self, input)