As shown here in PyTorch tutorials the code for an autoencoder model is like this:
class EncoderRNN(nn.Module): def __init__(self, input_size, hidden_size