791e7325a985bc8dd1a213c7cd1b1e888f934074,texar/modules/embedders/embedders.py,WordEmbedder,__init__,#WordEmbedder#Any#Any#Any#,50
Before Change
self._vocab_size = vocab_size
self._embedding = embedder_utils.get_embedding(
self._hparams, init_value, self._vocab_size, self.variable_scope)
self._dropout_layer = None
if self._hparams.dropout_rate > 0.:
with tf.variable_scope(tf.variable_scope):
self._dropout_layer = tf.layers.Dropout(
rate=self._hparams.dropout_rate)
if self._hparams.trainable:
self._add_trainable_variable(self._embedding)
if self._vocab_size is None:
self._vocab_size = self._embedding.get_shape().as_list()[0]
self._dim = self._embedding.get_shape().as_list()[1:]
if len(self._dim) == 1:
self._dim = self._dim[0]
self._built = True
@staticmethod
After Change
if self._vocab_size != self._num_embeds:
raise ValueError(
"vocab_size must equal to init_value.shape[0]."
"Got %d and %d" % (self._vocab_size, self._num_embeds))
self._built = True
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: asyml/texar
Commit Name: 791e7325a985bc8dd1a213c7cd1b1e888f934074
Time: 2018-05-27
Author: zhitinghu@gmail.com
File Name: texar/modules/embedders/embedders.py
Class Name: WordEmbedder
Method Name: __init__
Project Name: deepmipt/DeepPavlov
Commit Name: d86360af087d51f5e2cb2f9e57ddc95207fc3cd4
Time: 2018-06-05
Author: yurakuratov@gmail.com
File Name: deeppavlov/core/layers/tf_layers.py
Class Name:
Method Name: cudnn_lstm
Project Name: deepmipt/DeepPavlov
Commit Name: d86360af087d51f5e2cb2f9e57ddc95207fc3cd4
Time: 2018-06-05
Author: yurakuratov@gmail.com
File Name: deeppavlov/core/layers/tf_layers.py
Class Name:
Method Name: cudnn_gru