I do not now if i have understand you well.
On one side you can create a class instance that defines both the architecture of the decoder and the encoder. Or you can create different classes. In order to backprop just add both parameter list to the list of the parameters to update. For instance:
import torch
import torch.nn as nn
class autoencoder(nn.Module):
      def __init__(self):
             super(autoencoder, self).__init__()
             self.enc1=nn.Linear(784,512)
             self.enc2 = nn.Linear(512,256)
             self.dec1=nn.Linear(256,512)
             self.dec2=nn.Linear(512,784)
             self.f=nn.Sequential(self.enc1,self.enc2,self.dec1,self.dec2)#do it in this way just for clarity
     def forward(self,x):
            return self.f(x)

model = autoencoder()
parameter_list=model.parameters()

Or use different classes for the encoder and decoder
import torch
import torch.nn as nn
class decoder(nn.Module):
        def __init__(self):
                super(decoder, self).__init__()
                self.dec1=nn.Linear(256,512)
                self.dec2 = nn.Linear(512,784)
                self.f=nn.Sequential(self.dec1,self.dec2)#do it in this way just for clarity    
        def forward(self,x):
                return self.f(x)

class encoder(nn.Module):
        def __init__(self):
                super(encoder, self).__init__()
                self.enc1=nn.Linear(784,512)
                self.enc2 = nn.Linear(512,256)
                self.f=nn.Sequential(self.enc1,self.enc2)#do it in this way just for clarity    
        def forward(self,x):
                return self.f(x)

enc = encoder()
dec = decoder()
parameter_list=[for p in enc.parameters()]
parameter_list+=[for p in dec.parameters()]

There is no reason to create different classes for encoder and decoder network. It depends on what you want to do. You can always access your parameter through the named_parameters()attribute.  Btw you miss the inheritance from nn.Module when creating the class, the self passed as argument to the methods and the call to super.