44ae6129731ee1d225db8a5f1bafea5fd4b9b542,open_seq2seq/parts/transformer/utils.py,,get_position_encoding,#Any#Any#Any#Any#,28
Before Change
num_timescales = hidden_size // 2
log_timescale_increment = (
math.log(float(max_timescale) / float(min_timescale)) /
(tf.to_float(num_timescales) - 1))
inv_timescales = min_timescale * tf.exp(
tf.to_float(tf.range(num_timescales)) * -log_timescale_increment)
scaled_time = tf.expand_dims(position, 1) * tf.expand_dims(inv_timescales, 0)
After Change
Returns:
Tensor with shape [length, hidden_size]
position = tf.cast(tf.range(length),dtype=tf.float32)
num_timescales = hidden_size // 2
log_timescale_increment = (
math.log(float(max_timescale) / float(min_timescale)) /
(tf.cast((num_timescales) - 1, dtype=tf.float32)))
inv_timescales = min_timescale * tf.exp(
tf.cast(tf.range(num_timescales),dtype=tf.float32 ) * -log_timescale_increment)
scaled_time = tf.expand_dims(position, 1) * tf.expand_dims(inv_timescales, 0)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: NVIDIA/OpenSeq2Seq
Commit Name: 44ae6129731ee1d225db8a5f1bafea5fd4b9b542
Time: 2019-02-06
Author: boris.ginsburg@gmail.com
File Name: open_seq2seq/parts/transformer/utils.py
Class Name:
Method Name: get_position_encoding
Project Name: NVIDIA/OpenSeq2Seq
Commit Name: 5c26e48557d3e63f9d6b0b682fdcc425ebe9139b
Time: 2019-01-28
Author: boris.ginsburg@gmail.com
File Name: open_seq2seq/parts/transformer/utils.py
Class Name:
Method Name: get_position_encoding
Project Name: IndicoDataSolutions/finetune
Commit Name: be11a43d126b2b506323a65e05c6a40b98ee867f
Time: 2020-06-02
Author: benlt@hotmail.co.uk
File Name: finetune/nn/target_blocks.py
Class Name:
Method Name: _apply_class_weight
Project Name: NVIDIA/OpenSeq2Seq
Commit Name: 44ae6129731ee1d225db8a5f1bafea5fd4b9b542
Time: 2019-02-06
Author: boris.ginsburg@gmail.com
File Name: open_seq2seq/parts/transformer/utils.py
Class Name:
Method Name: get_position_encoding