I’m trying to load a created GNN model into an RNN controller and train to get the accuracy but when I run the RNN controller code I get this error “AttributeError: ‘GraphNetwork’ object has no attribute ‘layer_number’” even though “layer_number” is defined in the GNN model code. Any ideas on how to solve this will be greatly appreciated. thanks in advance. Below is a part of my GNN code where I’m getting the error.
The error is from this line “resultant_length = self.layer_number * state_number”
class GraphNetwork(torch.nn.Module):
def __init__(self, actions, num_features, num_labels, dropout=0.6, multi_label=False, batch_normal=False,
             residual=False, state_number=5, layer_number=3): #Hidden dimension absent: state number = 5
    
    # parameters => actions:
    # parameters => multi_labels:

    super(GraphNetwork, self).__init__()
    
    # args
    self.num_labels = num_labels
    self.dropout = dropout
    self.multi_label = multi_label
    self.num_features = num_features
    self.residual = residual
    
    # check architecture of GNN
    self.compute_actions(actions, state_number)
    self.layer_number = layer_number
    
    # layer module
    self.construct_model(actions, batch_normal, dropout, num_features, num_labels, state_number)

def construct_model(self, actions, batch_normal, dropout, num_features, num_labels, state_number):
    self.gates = torch.nn.ModuleList()
    self.layers = torch.nn.ModuleList()
    self.prediction = None
    self.construct_hidden_layers(actions, batch_normal, dropout, self.layer_number, num_features, num_labels, state_number)

def compute_actions(self, actions, state_number):
    state_length = len(actions)
    if not self.residual:
        resultant_length = self.layer_number * state_number
    else:
        resultant_length = sum([state_number+i for i in range(1,self.layer_number+1)])
    if state_length != resultant_length:
        raise RuntimeError("False Input : Unmatched input")
    if actions[-1] == self.num_label: #last action number = no. of labels; pass
        pass
    else:
        raise RuntimeError("False architecture") 

Below is the part of my controller code that loads the created GNN.