Dear all 
I have initialized a class as (nn.Module) named ‘GECorrection’, and  I’m trying to call it inside another one.
I got the TypeError: ‘GECorrection’ object is not iterable. I spent a lot of time trying to find the problem to work on, but I failed.
Any suggestions to start fixing this issue?
import torch
import torch.nn as nn
 
from heinsen_routing import Routing

class GECorrection(nn.Module):

    def __init__(self, a, mu, d_cov, d_inp, d_out, n_out):
        super().__init__()
        
        self.d_inp = d_inp # int value 
        self.d_out = d_out # int value 
        self.n_out = n_out # int value 
        self.d_cov = d_cov # int value 
        
        
        self.routings = nn.Sequential(Routing(d_cov=d_cov, d_inp=d_inp, d_out=d_out, n_out=n_out))
        #self.routings = Routing(d_cov = d_cov, d_inp = d_inp, d_out = d_out, n_out = n_out)
        
        #-----------------------------------------------------------------------------------------
        # Until here everything responds well 
        # 'self.routings' in iterable (Iterable = True)
        #-----------------------------------------------------------------------------------------
        
        
    def forward(self, a, mu):
        #-----------------------------------------------------------------------------------------
        # forward can't response even for empty tensors I get the same error 
        # TypeError: 'GECorrection' object is not iterable
        #-----------------------------------------------------------------------------------------

        for Routing in self.routings:
            
            a, mu, sig2 = Routing(a, mu)

        return a, mu, sig2

a_inp = torch.randn(128,  29)       
mu_inp = torch.randn(128, 29, 8, 32)

a, mu, sig2 = GECorrection(a_inp, mu_inp, 8, 32, 32, 29)

TypeError: 'GECorrection' object is not iterable.