ca78547252459e307031f1493771f524f83037bf,mmf/modules/embeddings.py,BertVisioLinguisticEmbeddings,get_position_embeddings_visual,#BertVisioLinguisticEmbeddings#,372

Before Change



            // When fine-tuning the detector , the image_text_alignment is
            // sometimes padded too long.
            if position_embeddings_visual.size(1) != visual_embeddings.size(1):
                assert position_embeddings_visual.size(1) >= visual_embeddings.size(1)
                position_embeddings_visual = position_embeddings_visual[
                    :, : visual_embeddings.size(1), :

After Change


            // We want to averge along the alignment_number dimension.
            image_text_alignment_mask = image_text_alignment_mask.sum(2)
            image_text_alignment_mask[image_text_alignment_mask == 0] = torch.tensor(
                [1], dtype=torch.long
            )  // Avoid devide by zero error
            position_embeddings_visual = (
                position_embeddings_visual / image_text_alignment_mask.unsqueeze(-1)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 2

Instances


Project Name: facebookresearch/pythia
Commit Name: ca78547252459e307031f1493771f524f83037bf
Time: 2020-09-11
Author: vedanujg@gmail.com
File Name: mmf/modules/embeddings.py
Class Name: BertVisioLinguisticEmbeddings
Method Name: get_position_embeddings_visual


Project Name: mapillary/inplace_abn
Commit Name: e6bbf54046cf4567e88cb130300b6b78ec88cb27
Time: 2018-11-28
Author: samuel@mapillary.com
File Name: test_imagenet.py
Class Name:
Method Name: validate


Project Name: Scitator/catalyst
Commit Name: f4beaac559e00a3676d942dc7e8fea69efc01cfe
Time: 2020-11-30
Author: raveforlive@gmail.com
File Name: catalyst/metrics/mrr.py
Class Name:
Method Name: mrr


Project Name: nerox8664/pytorch2keras
Commit Name: ad2100bf40e81c9964b9f4c8a3e5a9dbf5f4efd9
Time: 2018-11-24
Author: nerox8664@gmail.com
File Name: tests/layers/view.py
Class Name: TestView
Method Name: forward