Solved by a_d in post #2 
              
              
                You might want to use a module list. 
self.W_list =  nn.ModuleList()

for i  in range(relation_num):
    self.W_list.append(nn.Linear(self.dim, self.dim))