ab9e353c928218d12a977112d241c152ebcf06a9,src/gluonnlp/model/bert.py,BERTEncoder,hybrid_forward,#BERTEncoder#Any#Any#Any#Any#Any#,352

Before Change


            // valid_length for attention, shape = (batch_size, seq_length)
            attn_valid_len = F.broadcast_add(F.reshape(valid_length, shape=(-1, 1)),
                                             F.reshape(zeros, shape=(1, -1)))
            attn_valid_len = F.cast(attn_valid_len, dtype="int32")
            if states is None:
                states = [attn_valid_len]
            else:
                states.append(attn_valid_len)

After Change


            ones = F.ones_like(steps)
            mask = F.broadcast_lesser(F.reshape(steps, shape=(1, -1)),
                                      F.reshape(valid_length, shape=(-1, 1)))
            mask = F.broadcast_mul(F.expand_dims(mask, axis=1),
                                   F.broadcast_mul(ones, F.reshape(ones, shape=(-1, 1))))
            if states is None:
                states = [mask]
            else:
                states.append(mask)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: dmlc/gluon-nlp
Commit Name: ab9e353c928218d12a977112d241c152ebcf06a9
Time: 2020-01-27
Author: lausen@amazon.com
File Name: src/gluonnlp/model/bert.py
Class Name: BERTEncoder
Method Name: hybrid_forward


Project Name: tensorflow/transform
Commit Name: deeb372d527073813abb40a2b9a209ad050f1e44
Time: 2018-07-31
Author: tf-transform-dev@google.com
File Name: tensorflow_transform/analyzers.py
Class Name:
Method Name: mean


Project Name: broadinstitute/keras-rcnn
Commit Name: 7b1a03e58023300ad7bb14bc7e1aec5e4d7dd298
Time: 2017-08-26
Author: allen.goodman@icloud.com
File Name: keras_rcnn/layers/losses/_rpn.py
Class Name: RPNRegressionLoss
Method Name: compute_loss


Project Name: OpenNMT/OpenNMT-tf
Commit Name: 4d49910b3f0696102f813fb5ba451b934a4a579c
Time: 2021-03-25
Author: guillaumekln@users.noreply.github.com
File Name: opennmt/utils/losses.py
Class Name:
Method Name: cross_entropy_sequence_loss