def __init__(self, num_node_features, num_instr_features, dropout=0.1): super(RecurrentExecutionEngine, self).__init__() self.num_node_features = num_node_features self.num_instr_features = num_instr_features self.engine_one_step_execution_cell = self.get_RecurrentExecutionEngine_layer( ) self.graph_layer_norm = my_graph_layernorm.LayerNorm( self.num_node_features) self.softmax_bitmap_predictor = self.get_softmax_bitmap_predictor() self.history_vectors_mlp = Seq( Lin(num_node_features, num_instr_features), ReLU(), Lin(num_instr_features, num_instr_features) # output dim )
def __init__(self): super(GroundTruth_SceneGraph_Encoder, self).__init__() from gqa_dataset_entry import GQA_gt_sg_feature_lookup sg_TEXT = GQA_gt_sg_feature_lookup.SG_ENCODING_TEXT sg_vocab = GQA_gt_sg_feature_lookup.SG_ENCODING_TEXT.vocab self.sg_emb_dim = 300 # 300d glove sg_pad_idx = sg_vocab.stoi[sg_TEXT.pad_token] self.sg_vocab_embedding = torch.nn.Embedding(len(sg_vocab), self.sg_emb_dim, padding_idx=sg_pad_idx) # self.sg_vocab_embedding.weight.data.copy_(sg_vocab.vectors) del sg_TEXT, sg_vocab, sg_pad_idx ################################## # build scene graph encoding layer ################################## self.scene_graph_encoding_layer = get_gt_scene_graph_encoding_layer( num_node_features=self.sg_emb_dim, num_edge_features=self.sg_emb_dim) self.graph_layer_norm = my_graph_layernorm.LayerNorm(self.sg_emb_dim)