relational.py
def forward(self, x):
        """
        Implements the forward method of nn.Module Class
        Args:
            x(Tensor): batch_size x seqence_size x feature_size
        Returns:
            Tensor
        """
        b, d, k = x.size()   

        # cast all pairs against each other
        x_i = torch.unsqueeze(x, 1)                   # (B x 1 x 64 x 26)
        x_i = x_i.repeat(1, d, 1, 1)                    # (B x 64 x 64 x 26)
        x_j = torch.unsqueeze(x, 2)                   # (B x 64 x 1 x 26)

        x_j = x_j.repeat(1, 1, d, 1)                    # (B x 64 x 64 x 26)
        
        # concatenate all together
        x_full = torch.cat([x_i, x_j], 3)         # (B x 64 x 64 x 2*26)
        x_full = self.edge_feature(x_full)       # (B x 64 x 64 x 2*26)
        
        # reshape for passing through network
        x_ = x_full.view(b * d**2, self.in_size)

        for idx, (g_layer, g_layer_size) in enumerate(zip(self.g_layers, self.g_layers_size)):          
            x_ = g_layer(x_)
            x_ = F.relu(x_)

        # reshape again and sum
        x_g = x_.view(b, d**2, self.g_layers_size[-1])
        x_g = x_g.sum(1).squeeze(1)
        
        """f"""
        x_f = self.f_fc1(x_g)
        x_f = F.relu(x_f)
        x_f = self.f_fc2(x_f)
        x_f = self.dropout(x_f)
        x_f = F.relu(x_f)
        x_f = self.f_fc3(x_f)
        x_f1, x_f2 = torch.split(x_f, 350, dim=1)
        return [F.log_softmax(x_f1, dim=1), F.log_softmax(x_f2, dim=1)]

        Implements the forward method of nn.Module Class
        Args:
            x(Tensor): batch_size x seqence_size x feature_size
        Returns:
            Tensor
        
Implements the forward method of nn.Module Class
Implements the forward method of nn . Module Class
def forward(self, x):
        b, d, k = x.size()   
        x_i = torch.unsqueeze(x, 1)                   
        x_i = x_i.repeat(1, d, 1, 1)                    
        x_j = torch.unsqueeze(x, 2)                   
        x_j = x_j.repeat(1, 1, d, 1)                    
        x_full = torch.cat([x_i, x_j], 3)         
        x_full = self.edge_feature(x_full)       
        x_ = x_full.view(b * d**2, self.in_size)
        for idx, (g_layer, g_layer_size) in enumerate(zip(self.g_layers, self.g_layers_size)):          
            x_ = g_layer(x_)
            x_ = F.relu(x_)
        x_g = x_.view(b, d**2, self.g_layers_size[-1])
        x_g = x_g.sum(1).squeeze(1)
        x_f = self.f_fc1(x_g)
        x_f = F.relu(x_f)
        x_f = self.f_fc2(x_f)
        x_f = self.dropout(x_f)
        x_f = F.relu(x_f)
        x_f = self.f_fc3(x_f)
        x_f1, x_f2 = torch.split(x_f, 350, dim=1)
        return [F.log_softmax(x_f1, dim=1), F.log_softmax(x_f2, dim=1)]
def forward ( self , x ) : b , d , k = x . size ( ) x_i = torch . unsqueeze ( x , 1 ) x_i = x_i . repeat ( 1 , d , 1 , 1 ) x_j = torch . unsqueeze ( x , 2 ) x_j = x_j . repeat ( 1 , 1 , d , 1 ) x_full = torch . cat ( [ x_i , x_j ] , 3 ) x_full = self . edge_feature ( x_full ) x_ = x_full . view ( b * d ** 2 , self . in_size ) for idx , ( g_layer , g_layer_size ) in enumerate ( zip ( self . g_layers , self . g_layers_size ) ) : x_ = g_layer ( x_ ) x_ = F . relu ( x_ ) x_g = x_ . view ( b , d ** 2 , self . g_layers_size [ - 1 ] ) x_g = x_g . sum ( 1 ) . squeeze ( 1 ) """f""" x_f = self . f_fc1 ( x_g ) x_f = F . relu ( x_f ) x_f = self . f_fc2 ( x_f ) x_f = self . dropout ( x_f ) x_f = F . relu ( x_f ) x_f = self . f_fc3 ( x_f ) x_f1 , x_f2 = torch . split ( x_f , 350 , dim = 1 ) return [ F . log_softmax ( x_f1 , dim = 1 ) , F . log_softmax ( x_f2 , dim = 1 ) ]
Implements the forward method of nn.Module Class
Implements the forward method of nn . Module Class
"""
        Implements the forward method of nn.Module Class
        Args:
            x(Tensor): batch_size x seqence_size x feature_size
        Returns:
            Tensor
        """ # cast all pairs against each other # (B x 1 x 64 x 26) # (B x 64 x 64 x 26) # (B x 64 x 1 x 26) # (B x 64 x 64 x 26) # concatenate all together # (B x 64 x 64 x 2*26) # (B x 64 x 64 x 2*26) # reshape for passing through network # reshape again and sum """f"""
None
self
x
batch_size x seqence_size x feature_size
batch_size x seqence_size x feature_size