f1d2a776dfa29bf08a8a13745be82e7d6788e365,keras/layers/dense_attention.py,BaseDenseAttention,_apply_scores,#BaseDenseAttention#Any#Any#Any#Any#,93

Before Change


    if scores_mask is not None:
      padding_mask = tf.logical_not(scores_mask)
      // Bias so padding positions do not contribute to attention distribution.
      scores -= 1.e9 * tf.cast(padding_mask, dtype=K.floatx())
    if training is None:
      training = K.learning_phase()
    weights = tf.compat.v1.math.softmax(scores)

After Change


      padding_mask = tf.logical_not(scores_mask)
      // Bias so padding positions do not contribute to attention distribution.
      // Note 65504. is the max float16 value.
      if scores.dtype is tf.float16:
        scores -= 65504. * tf.cast(padding_mask, dtype=scores.dtype)
      else:
        scores -= 1.e9 * tf.cast(padding_mask, dtype=scores.dtype)
    if training is None:
      training = K.learning_phase()
    weights = tf.compat.v1.math.softmax(scores)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: keras-team/keras
Commit Name: f1d2a776dfa29bf08a8a13745be82e7d6788e365
Time: 2021-01-25
Author: scottzhu@google.com
File Name: keras/layers/dense_attention.py
Class Name: BaseDenseAttention
Method Name: _apply_scores


Project Name: Hironsan/anago
Commit Name: 7c54ef6464c5d2885faf3e8b3ad60451d1894d7a
Time: 2018-05-28
Author: hiroki.nakayama.py@gmail.com
File Name: anago/layers.py
Class Name: ChainCRF
Method Name: build


Project Name: keras-team/keras
Commit Name: 023331ec2a7b0086abfc81eca16c84a1692ee653
Time: 2017-02-09
Author: francois.chollet@gmail.com
File Name: keras/layers/core.py
Class Name: TimeDistributedDense
Method Name: build