88a836a73c0b324fc116f284759dbb9c3de22e63,mmf/modules/encoders.py,ImageFeatureEncoder,__init__,#ImageFeatureEncoder#Any#,54

Before Change


        ), "ImageFeatureEncoder require "in_dim" param in config"
        params = config.params

        if encoder_type == "default" or encoder_type == "identity":
            self.module = Identity()
            self.module.in_dim = params.in_dim
            self.module.out_dim = params.in_dim
        elif encoder_type == "projection":
            if "module" not in params:
                params = deepcopy(params)
                params.module = "linear"
            self.module = ProjectionEmbedding(**params)
        elif encoder_type == "finetune_faster_rcnn_fpn_fc7":
            self.module = FinetuneFasterRcnnFpnFc7(**params)
        else:
            raise NotImplementedError("Unknown Image Encoder: %s" % encoder_type)

        self.out_dim = self.module.out_dim

    def forward(self, *args, **kwargs):
        return self.module(*args, **kwargs)

After Change


        if isinstance(self._type, TextEncoderTypes):
            self._type = self._type.value

        if self._type == "identity":
            self.module = nn.Identity()
        elif self._type == "transformer":
            self._module = TransformerEncoder(config.params)
            self.module = self._module.module
        elif self._type == "embedding":
            self.module = TextEmbeddingEncoder(config.params)
        else:
            raise NotImplementedError(f"Unknown Text Encoder {self._type}")

    def forward(self, *args, **kwargs):
        return self.module(*args, **kwargs)

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: facebookresearch/pythia
Commit Name: 88a836a73c0b324fc116f284759dbb9c3de22e63
Time: 2020-10-14
Author: asg@fb.com
File Name: mmf/modules/encoders.py
Class Name: ImageFeatureEncoder
Method Name: __init__


Project Name: idaholab/raven
Commit Name: 2a3d7175b8da52a64da24e2ed64ca3421ded6bbe
Time: 2017-05-25
Author: paul.talbot@inl.gov
File Name: framework/Optimizers/GradientBasedOptimizer.py
Class Name: GradientBasedOptimizer
Method Name: localFinalizeActualSampling


Project Name: scipy/scipy
Commit Name: aee644931d66a4e4eca62da1ce32597e330e341c
Time: 2006-12-20
Author: mattknox_ca@localhost
File Name: Lib/sandbox/timeseries/timeseries.py
Class Name: TimeSeries
Method Name: convert