bc08dbfbe77554bf3458529285003f0bf92eecd3,sonnet/python/modules/nets/vqvae.py,VectorQuantizer,_build,#VectorQuantizer#Any#Any#,67
Before Change
encoding_indices = tf.argmax(- distances, 1)
encodings = tf.one_hot(encoding_indices, self._num_embeddings)
quantized = tf.reshape(
tf.matmul(encodings, self._w, transpose_b=True), tf.shape(inputs))
e_latent_loss = tf.reduce_mean((tf.stop_gradient(quantized) - inputs) ** 2)
q_latent_loss = tf.reduce_mean((quantized - tf.stop_gradient(inputs)) ** 2)
loss = q_latent_loss + self._commitment_cost * e_latent_loss
After Change
encoding_indices = tf.argmax(- distances, 1)
encodings = tf.one_hot(encoding_indices, self._num_embeddings)
encoding_indices = tf.reshape(encoding_indices, inputs.shape.as_list()[:-1])
quantized = self.quantize(encoding_indices)
e_latent_loss = tf.reduce_mean((tf.stop_gradient(quantized) - inputs) ** 2)
q_latent_loss = tf.reduce_mean((quantized - tf.stop_gradient(inputs)) ** 2)
loss = q_latent_loss + self._commitment_cost * e_latent_loss
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 6
Instances
Project Name: deepmind/sonnet
Commit Name: bc08dbfbe77554bf3458529285003f0bf92eecd3
Time: 2018-07-17
Author: fviola@google.com
File Name: sonnet/python/modules/nets/vqvae.py
Class Name: VectorQuantizer
Method Name: _build
Project Name: NifTK/NiftyNet
Commit Name: 4421754f9886233e90563eb8088348bb36024095
Time: 2018-01-12
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/layer/loss_segmentation.py
Class Name: LossFunction
Method Name: layer_op
Project Name: deepmind/sonnet
Commit Name: bc08dbfbe77554bf3458529285003f0bf92eecd3
Time: 2018-07-17
Author: fviola@google.com
File Name: sonnet/python/modules/nets/vqvae.py
Class Name: VectorQuantizerEMA
Method Name: _build
Project Name: NifTK/NiftyNet
Commit Name: 3a5ace850931e91c55a692ae7ec716a57e66f4e6
Time: 2018-01-26
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/layer/loss_segmentation.py
Class Name: LossFunction
Method Name: layer_op