3c874575bf40e8b1fa2280371131a8f29ebb3e98,src/gluonnlp/models/roberta.py,RobertaModel,hybrid_forward,#RobertaModel#Any#Any#Any#,227

Before Change


                                   bias_initializer=bias_initializer)

    def hybrid_forward(self, F, tokens, valid_length):
        outputs = []
        embedding = self.get_initial_embedding(F, tokens)

        contextual_embeddings, additional_outputs = self.encoder(embedding, valid_length)
        outputs.append(contextual_embeddings)
        if self._output_all_encodings:
            contextual_embeddings = contextual_embeddings[-1]

        if self.use_pooler:
            pooled_out = self.apply_pooling(contextual_embeddings)
            outputs.append(pooled_out)

        return tuple(outputs) if len(outputs) > 1 else outputs[0]

    def get_initial_embedding(self, F, inputs):
        Get the initial token embeddings that considers the token type and positional embeddings

After Change



    def hybrid_forward(self, F, tokens, valid_length):
        embedding = self.get_initial_embedding(F, tokens)
        if self._layout != self._compute_layout:
            contextual_embeddings, additional_outputs = self.encoder(F.np.swapaxes(embedding, 0, 1),
                                                                     valid_length)
            contextual_embeddings = F.np.swapaxes(contextual_embeddings, 0, 1)
        else:
            contextual_embeddings, additional_outputs = self.encoder(embedding, valid_length)
        if self.use_pooler:
            if isinstance(contextual_embeddings, list):
                pooled_out = self.apply_pooling(contextual_embeddings[-1])
            else:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: dmlc/gluon-nlp
Commit Name: 3c874575bf40e8b1fa2280371131a8f29ebb3e98
Time: 2020-07-28
Author: xshiab@connect.ust.hk
File Name: src/gluonnlp/models/roberta.py
Class Name: RobertaModel
Method Name: hybrid_forward


Project Name: dmlc/gluon-nlp
Commit Name: 3c874575bf40e8b1fa2280371131a8f29ebb3e98
Time: 2020-07-28
Author: xshiab@connect.ust.hk
File Name: src/gluonnlp/models/mobilebert.py
Class Name: MobileBertModel
Method Name: hybrid_forward


Project Name: Picovoice/porcupine
Commit Name: c2cf686f1f8e8a7f81b89010b60911648a0b77b1
Time: 2021-02-26
Author: 42750891+mrrostam@users.noreply.github.com
File Name: binding/python/util.py
Class Name:
Method Name: _pv_linux_machine