06ecac8d4a0132657e8cd8ef9eb3cc5a48d3859f,src/gluonnlp/model/attention_cell.py,MLPAttentionCell,_compute_weight,#MLPAttentionCell#Any#Any#Any#Any#,356

Before Change


    def _compute_weight(self, F, query, key, mask=None):
        mapped_query = self._query_mid_layer(query)
        mapped_key = self._key_mid_layer(key)
        mid_feat = F.broadcast_add(F.expand_dims(mapped_query, axis=2),
                                   F.expand_dims(mapped_key, axis=1))
        mid_feat = self._act(mid_feat)
        att_score = self._attention_score(mid_feat).reshape(shape=(0, 0, 0))
        att_weights = self._dropout_layer(_masked_softmax(F, att_score, mask, self._dtype))
        return att_weights

After Change


    def _compute_weight(self, F, query, key, mask=None):
        att_score = self._compute_score(F, query, key, mask)
        att_weights = F.softmax(att_score, axis=-1)
        if mask is not None:
            att_weights = att_weights * mask
        att_weights = self._dropout_layer(att_weights)
        return att_weights

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: dmlc/gluon-nlp
Commit Name: 06ecac8d4a0132657e8cd8ef9eb3cc5a48d3859f
Time: 2019-10-24
Author: emilmont@gmail.com
File Name: src/gluonnlp/model/attention_cell.py
Class Name: MLPAttentionCell
Method Name: _compute_weight


Project Name: shenweichen/DeepCTR
Commit Name: 5a9e9622a7309794cc0cf511080fc2bd6b73a20a
Time: 2019-11-06
Author: wcshen1994@163.com
File Name: deepctr/layers/sequence.py
Class Name: SequenceMultiplyLayer
Method Name: call


Project Name: asyml/texar
Commit Name: b5c8bdd81be77eac5434a476f62c5bdef56f1838
Time: 2019-07-01
Author: haoranshi97@gmail.com
File Name: texar/modules/embedders/position_embedders.py
Class Name: SinusoidsPositionEmbedder
Method Name: __init__