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

Before Change


    ) -> 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)))

After Change


        segment_ids: Dict[str, Tensor],
    ) -> Tensor:
        list_embeddings = []
        for idx, (token_emb, pos_emb, layer_norm, dropout) in enumerate(
            zip(
                self.token_embeddings,
                self.pos_embeddings,
                self.layer_norms,
                self.dropouts,
            )
        ):
            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: 6

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: ilastik/ilastik
Commit Name: cd7dfe55a56b2eb53dcd61e1db27aad0da1db301
Time: 2019-07-10
Author: tomaz.vieira@embl.de
File Name: ilastik/applets/dataSelection/datasetInfoEditorWidget.py
Class Name: DatasetInfoEditorWidget
Method Name: __init__


Project Name: ilastik/ilastik
Commit Name: 9d5812a8a844ac6bada7fdd81bc1ae1308c3fca0
Time: 2019-07-10
Author: tomaz.vieira@embl.de
File Name: ilastik/applets/dataSelection/datasetInfoEditorWidget.py
Class Name: DatasetInfoEditorWidget
Method Name: __init__