def __init__(self, upper_part_list=[1, 2, 3, 4], lower_part_list=[5, 6], in_dim=256, hidden_dim=10, cls_p=7, cls_h=3, cls_f=2): super(Half_Graph, self).__init__() self.upper_part_list = upper_part_list self.lower_part_list = lower_part_list self.upper_parts_len = len(upper_part_list) self.lower_parts_len = len(lower_part_list) self.hidden = hidden_dim self.decomp_fhu = Decomposition(in_dim, hidden_dim) self.decomp_fhl = Decomposition(in_dim, hidden_dim) self.part_dp_h = Part_Dependency(in_dim, hidden_dim) self.part_dp_l = Part_Dependency(in_dim, hidden_dim) self.att = nn.Sequential( nn.Conv2d((cls_h - 1) * hidden_dim, cls_h - 1, kernel_size=1, padding=0, stride=1, bias=True, groups=cls_h - 1), nn.Sigmoid()) self.comp_phu = Composition(hidden_dim, self.upper_parts_len) self.comp_phl = Composition(hidden_dim, self.lower_parts_len) self.update_u = conv_Update(hidden_dim) self.update_l = conv_Update(hidden_dim)
def __init__(self, upper_part_list=[1, 2, 3, 4], lower_part_list=[5, 6], in_dim=256, hidden_dim=10, cls_p=7, cls_h=3, cls_f=2): super(Half_Graph, self).__init__() self.upper_part_list = upper_part_list self.lower_part_list = lower_part_list self.upper_parts_len = len(upper_part_list) self.lower_parts_len = len(lower_part_list) self.hidden = hidden_dim self.decomp_fhu = Decomposition(hidden_dim) self.comp_phu = Composition(hidden_dim, self.upper_parts_len) self.part_dp_u = Part_Dependency(hidden_dim) self.part_dp_l = Part_Dependency(hidden_dim) self.decomp_fhl = Decomposition(hidden_dim) self.comp_phl = Composition(hidden_dim, self.lower_parts_len) self.update_u = conv_Update(hidden_dim, 3) self.update_l = conv_Update(hidden_dim, 3)
def __init__(self, adj_matrix, upper_part_list=[1, 2, 3, 4], lower_part_list=[5, 6], in_dim=256, hidden_dim=10, cls_p=7, cls_h=3, cls_f=2): super(Part_Graph, self).__init__() self.cls_p = cls_p self.upper_part_list = upper_part_list self.lower_part_list = lower_part_list self.edge_index = torch.nonzero(adj_matrix) self.edge_index_num = self.edge_index.shape[0] self.part_dp_list = nn.ModuleList( [Part_Dependency(hidden_dim) for i in range(self.edge_index_num)]) self.decomp_hp_list = nn.ModuleList( [Decomposition(hidden_dim) for i in range(cls_p - 1)]) self.decomp_fp_list = nn.ModuleList( [Decomposition(hidden_dim) for i in range(cls_p - 1)]) self.update_conv_list = nn.ModuleList( [conv_Update(hidden_dim, 3) for i in range(cls_p - 1)])
def __init__(self, adj_matrix, upper_part_list=[1, 2, 3, 4], lower_part_list=[5, 6], in_dim=256, hidden_dim=10, cls_p=7, cls_h=3, cls_f=2): super(Part_Graph, self).__init__() self.cls_p = cls_p self.upper_part_list = upper_part_list self.lower_part_list = lower_part_list self.edge_index = torch.nonzero(adj_matrix) self.edge_index_num = self.edge_index.shape[0] self.part_dp_list = nn.ModuleList( [Part_Dependency(hidden_dim) for i in range(self.edge_index_num)]) self.att = nn.Sequential( nn.Conv2d((cls_p - 1) * hidden_dim, cls_p - 1, kernel_size=1, padding=0, stride=1, bias=True, groups=cls_p - 1), nn.Sigmoid()) self.decomp_hp_list = nn.ModuleList( [Decomposition(hidden_dim) for i in range(cls_p - 1)]) self.decomp_fp_list = nn.ModuleList( [Decomposition(hidden_dim) for i in range(cls_p - 1)]) self.update_conv_list = nn.ModuleList( [conv_Update(hidden_dim, 3) for i in range(cls_p - 1)])