Skip to content

Question about processing entity output in model #4

@liuyaduo

Description

@liuyaduo

Hi!
In original paper,I found that they apply an activation operation and add a fully connected layer after the average operation to get a vector representation for each of the two target entities.

def extract_entity(sequence_output, e_mask):
       extended_e_mask = e_mask.unsqueeze(1)
       extended_e_mask = torch.bmm(
                extended_e_mask.float(), sequence_output).squeeze(1)
       return extended_e_mask.float()

e1_h = self.ent_dropout(extract_entity(sequence_output, e1_mask))
e2_h = self.ent_dropout(extract_entity(sequence_output, e2_mask))
context = self.cls_dropout(pooled_output)
pooled_output = torch.cat([context, e1_h, e2_h], dim=-1)

why don't I find activation and fully connected layer in model.py?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions