51498b09368a61bfb06849693688df6eb54d4787,python/eight_mile/tf/embeddings.py,PositionalCharConvEmbeddings,encode,#PositionalCharConvEmbeddings#Any#,445

Before Change


    def encode(self, x=None):
        x = super(PositionalCharConvEmbeddings, self).encode(x) * math.sqrt(self.dsz)
        B, T, C = get_shape_as_list(x)
        signal = get_timing_signal_1d(T, C, min_timescale=1.0, max_timescale=self.max_timescale, start_index=0)
        return x + signal

    def get_vsz(self):
        return self.vsz

After Change


    def encode(self, x):
        x = super().encode(x) * tf.constant(self.scale)
        T = tf.shape(x)[1]
        pos = self.positional(T)
        return self.dropout(x + pos, training=TRAIN_FLAG())


class LearnedPositionalCharConvEmbeddings(LearnedPositionalMixin, CharConvEmbeddings):
    def __init__(self, trainable=True, name=None, dtype=tf.float32, **kwargs):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 9

Instances


Project Name: dpressel/mead-baseline
Commit Name: 51498b09368a61bfb06849693688df6eb54d4787
Time: 2019-11-14
Author: blester125@gmail.com
File Name: python/eight_mile/tf/embeddings.py
Class Name: PositionalCharConvEmbeddings
Method Name: encode


Project Name: dpressel/mead-baseline
Commit Name: 51498b09368a61bfb06849693688df6eb54d4787
Time: 2019-11-14
Author: blester125@gmail.com
File Name: python/eight_mile/tf/embeddings.py
Class Name: LearnedPositionalCharConvEmbeddings
Method Name: encode


Project Name: dpressel/mead-baseline
Commit Name: 51498b09368a61bfb06849693688df6eb54d4787
Time: 2019-11-14
Author: blester125@gmail.com
File Name: python/eight_mile/tf/embeddings.py
Class Name: PositionalLookupTableEmbeddings
Method Name: encode


Project Name: dpressel/mead-baseline
Commit Name: 51498b09368a61bfb06849693688df6eb54d4787
Time: 2019-11-14
Author: blester125@gmail.com
File Name: python/eight_mile/tf/embeddings.py
Class Name: LearnedPositionalLookupTableEmbeddings
Method Name: encode