a97304d53e873ce5949b486c8fcbf5d4fcab7a3b,adversarial_text/adversarial_losses.py,,_scale_l2,#Any#Any#,174
Before Change
// shape(x) = (batch, num_timesteps, d)
x /= (1e-12 + tf.reduce_max(tf.abs(x), 2, keep_dims=True))
x_2 = tf.reduce_sum(tf.pow(x, 2), 2, keep_dims=True)
x /= tf.sqrt(1e-6 + x_2)
return norm_length * x
After Change
// 2norm(x) = a * 2norm(x/a)
// Scale over the full sequence, dims (1, 2)
alpha = tf.reduce_max(tf.abs(x), (1, 2), keep_dims=True) + 1e-12
l2_norm = alpha * tf.sqrt(tf.reduce_sum(tf.pow(x / alpha, 2), (1, 2),
keep_dims=True) + 1e-6)
x_unit = x / l2_norm
return norm_length * x_unit
def _end_of_seq_mask(tokens):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: tensorflow/models
Commit Name: a97304d53e873ce5949b486c8fcbf5d4fcab7a3b
Time: 2017-05-03
Author: rsepassi@google.com
File Name: adversarial_text/adversarial_losses.py
Class Name:
Method Name: _scale_l2
Project Name: tensorflow/cleverhans
Commit Name: 54633472520dc22cf9f91925eb76e9b8032fbb4c
Time: 2018-07-03
Author: krishnaphaniiitg@gmail.com
File Name: cleverhans_tutorials/tutorial_models.py
Class Name: Linear
Method Name: set_input_shape
Project Name: tensorflow/cleverhans
Commit Name: 4a98678d4a52bc32f9c25493fa248ba5aed16dde
Time: 2018-07-01
Author: krishnaphaniiitg@gmail.com
File Name: cleverhans_tutorials/tutorial_models.py
Class Name: Linear
Method Name: set_input_shape
Project Name: tensorflow/models
Commit Name: a97304d53e873ce5949b486c8fcbf5d4fcab7a3b
Time: 2017-05-03
Author: rsepassi@google.com
File Name: adversarial_text/adversarial_losses.py
Class Name:
Method Name: _scale_l2