Thank you for your comment!
I’m not interested in the weights; I report below a simple example to shows more clear what is my objective:
class Net(nn.Module, NetVariables):
    def __init__(self, params):
        
        self.params = params.copy()
        
        nn.Module.__init__(self)
        NetVariables.__init__(self, self.params)        
        
        # number of hidden nodes in each layer (32)
        hidden_1 = 32
        hidden_2 = 32

        # linear layer (784 -> hidden_1)
        if  (params['Dataset']=='MNIST'):
            self.fc1 = nn.Linear(28*28, hidden_1)
        #NOTE: images in MNIST dataset are b&w photos with 28*28 pixels, CIFAR10 instead contain with colored photos (3 colour channel) with 32*32 pixels 
        elif  (params['Dataset']=='CIFAR10'):
            self.fc1 = nn.Linear(32*32*3, hidden_1)
        # linear layer (n_hidden -> hidden_2)
        self.fc2 = nn.Linear(hidden_1,hidden_2)
        # linear layer (n_hidden -> 10)
        self.fc3 = nn.Linear(hidden_2, self.num_classes)
        
        #weights initialization (this step can also be put below in a separate def)
        nn.init.kaiming_normal_(self.fc1.weight, mode='fan_in', nonlinearity='relu')
        nn.init.kaiming_normal_(self.fc2.weight, mode='fan_in', nonlinearity='relu')
        nn.init.xavier_normal_(self.fc3.weight)
        #initialize the bias to 0
        nn.init.constant_(self.fc3.bias, 0)
    #I return from the forward a dictionary to get the output after each layer not only the last one
    def forward(self,x):
        
        outs = {}
        # flatten image input
        if  (self.params['Dataset']=='MNIST'):
            x = x.view(-1,28*28)
        #NOTE: images in MNIST dataset are b&w photos with 28*28 pixels, CIFAR10 instead contain with colored photos (3 colour channel) with 32*32 pixels 
        elif  (self.params['Dataset']=='CIFAR10'):
            x = x.view(-1,32*32*3)
        # add hidden layer, with relu activation function
        Fc1 = F.relu(self.fc1(x))
        
        outs['l1'] = Fc1
       
        Fc2 = torch.tanh(self.fc2(Fc1))
        
        
        outs['l2'] = Fc2
        
        # add output layer
        Out = self.fc3(Fc2)
        
        outs['out'] = Out
        
        return outs


In the above example the forward propagation return not only the output layer but a dictionary that contain also all the previous ones (hidden layer outputs); this is all I want. On the other hand with more complex networks the number of hidden layer increases, so I’d like to not do it manually with the dictionary approach above; I’d like to iterate over the hidden layers and get the corresponding output tensors (outs['l1'] and  outs['l2'] in the above example)