2f337387d6759627bae60284e7fa612268580724,mmf/models/mmf_transformer.py,MMFTransformerEmbeddings,forward,#MMFTransformerEmbeddings#,155

Before Change


        segment_ids: Dict[str, Tensor],
    ) -> Tensor:
        list_embeddings = []
        for modality in self.model_config.modalities:
            total_embedding = getattr(self, modality.key + "_embedding")(
                input_ids[modality.key]
            )
            if modality.key not in position_ids:
                total_embedding += getattr(self, modality.key + "_pos_embedding")(
                    position_ids[modality.key]
                )

            if modality.key in segment_ids:
                total_embedding += self.token_type_embeddings(segment_ids[modality.key])

            layer_norm_layer = getattr(self, modality.key + "_layer_norm")
            dropout_layer = getattr(self, modality.key + "_dropout")
            list_embeddings.append(dropout_layer(layer_norm_layer(total_embedding)))

        return torch.cat(list_embeddings, dim=1)


@registry.register_model("mmf_transformer")

After Change


            )
        ):
            modality_name = self.modality_keys[idx]
            total_embedding = token_emb(input_ids[modality_name])
            if modality_name in position_ids:
                total_embedding += pos_emb(position_ids[modality_name])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: facebookresearch/pythia
Commit Name: 2f337387d6759627bae60284e7fa612268580724
Time: 2020-09-15
Author: vedanujg@gmail.com
File Name: mmf/models/mmf_transformer.py
Class Name: MMFTransformerEmbeddings
Method Name: forward


Project Name: lingpy/lingpy
Commit Name: a84938a83a0bc2bfc9fb6e377424d1547be0a054
Time: 2013-04-20
Author: bambooforest@gmail.com
File Name: lingpy/basic/spreadsheet.py
Class Name: Spreadsheet
Method Name: output


Project Name: nilmtk/nilmtk
Commit Name: 1250f47a9ad3a914783f26d1711692794c7ea031
Time: 2014-05-01
Author: jack-list@xlk.org.uk
File Name: nilmtk/pipeline/locategapsnode.py
Class Name: LocateGapsNode
Method Name: process