Esempio n. 1
0
    def setup_layers(self):
        """
        Creating the layers.
        """
        self.calculate_bottleneck_features()
        # 三层GCN
        '''
        GCN init: def __init__(self, in_channels, out_channels)
        def forward(self, x, edge_index):
            x has shape [N, in_channels]
            edge_index has shape [2, E]
        '''
        self.convolution_1 = GCNConv(self.number_labels, self.args.filters_1)
        self.convolution_2 = GCNConv(self.args.filters_1, self.args.filters_2)
        self.convolution_3 = GCNConv(self.args.filters_2, self.args.filters_3)
        # 得到 [n, out_channels]

        # att
        self.attention = AttentionModule(self.args)

        # 用来计算 embedding_graph_1  和 embedding_graph_2 的合并向量
        self.tensor_network = TenorNetworkModule(self.args)

        # bottle-neck-neurons , 16
        # feature_count , 16
        # [16, 16]
        self.fully_connected_first = torch.nn.Linear(
            self.feature_count, self.args.bottle_neck_neurons)
        # [16, 1]
        self.scoring_layer = torch.nn.Linear(self.args.bottle_neck_neurons, 1)
Esempio n. 2
0
 def setup_layers(self):
     """
     Creating the layers.
     """
     self.calculate_bottleneck_features()
     self.convolution_1 = GCNConv(self.number_labels, self.args.filters_1)
     self.convolution_2 = GCNConv(self.args.filters_1, self.args.filters_2)
     self.convolution_3 = GCNConv(self.args.filters_2, self.args.filters_3)
     self.attention = AttentionModule(self.args)
     self.tensor_network = TenorNetworkModule(self.args)
     self.fully_connected_first = torch.nn.Linear(
         self.feature_count, self.args.bottle_neck_neurons)
     self.scoring_layer = torch.nn.Linear(self.args.bottle_neck_neurons, 1)
Esempio n. 3
0
 def setup_layers(self):
     """
     Creating the layers.
     """
     self.calculate_bottleneck_features()
     self.convolution_1 = GCNConv(100352, 128)
     self.convolution_2 = GCNConv(self.args.filters_1, self.args.filters_2)
     self.convolution_3 = GCNConv(self.args.filters_2, self.args.filters_3)
     self.attention = AttentionModule(self.args)
     self.tensor_network = TenorNetworkModule(self.args)
     self.fully_connected_first = torch.nn.Linear(self.feature_count,
                                                  self.args.bottle_neck_neurons)
     self.scoring_layer = torch.nn.Linear(self.args.bottle_neck_neurons, 1)
     self.vggg = list(torchvision.models.vgg16(pretrained=True).cuda().children())[0][:24]
     self.backbone = torch.nn.Sequential(*self.vggg)