| 826 | return a_t_ab |
| 827 | |
| 828 | def create_compositional_graph(self, attribute_label): |
| 829 | att_num = attribute_label.size(1) |
| 830 | copy_attribute_label = attribute_label.detach() |
| 831 | adj_list = [] |
| 832 | for row in copy_attribute_label: |
| 833 | adj = torch.zeros((att_num + 1, att_num + 1)) |
| 834 | non_zero_positions = torch.nonzero(row) |
| 835 | for p in non_zero_positions: |
| 836 | adj[p, att_num] = 1 |
| 837 | adj[att_num, p] = 1 |
| 838 | adj_list.append(adj) |
| 839 | adj_matrix = torch.stack(adj_list, dim=0).to(device=self.device) |
| 840 | |
| 841 | return adj_matrix |
| 842 | |
| 843 | |
| 844 | class Meta_Attribute_Generator1(nn.Module): |