Skip to content

Commit 44f05aa

Browse files
committed
update AverageEmbeddingInputlayer
1 parent ccbf0a4 commit 44f05aa

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

tensorlayer/layers.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -652,31 +652,32 @@ def __init__(
652652

653653

654654
class AverageEmbeddingInputlayer(Layer):
655+
"""The :class:`AverageEmbeddingInputlayer` class is for FastText Embedding for sentence classification, see `[1] <http://arxiv.org/abs/1607.01759>`_.
656+
657+
Parameters
658+
------------
659+
inputs : input placeholder or tensor; zeros are paddings
660+
vocabulary_size : an integer, the size of vocabulary
661+
embedding_size : an integer, the dimension of embedding vectors
662+
name : a string, the name of the layer
663+
embeddings_initializer : the initializer of the embedding matrix
664+
embeddings_kwargs : kwargs to get embedding matrix variable
665+
666+
References
667+
------------
668+
- [1] Joulin, A., Grave, E., Bojanowski, P., & Mikolov, T. (2016).
669+
`Bag of Tricks for Efficient Text Classification. <http://arxiv.org/abs/1607.01759>`_
670+
- [2] Recht, B., Re, C., Wright, S., & Niu, F. (2011).
671+
`Hogwild: A Lock-Free Approach to Parallelizing Stochastic Gradient Descent. <https://arxiv.org/abs/1106.5730>`_
672+
In Advances in Neural Information Processing Systems 24 (pp. 693–701).
673+
- [3] `TensorFlow Candidate Sampling <https://www.tensorflow.org/api_guides/python/nn#Candidate_Sampling>`_
674+
"""
655675
def __init__(
656676
self, inputs, vocabulary_size, embedding_size,
657677
name='fasttext_layer',
658678
embeddings_initializer=tf.random_uniform_initializer(-0.1, 0.1),
659-
embeddings_kwargs={}):#None):
660-
"""The :class:`AverageEmbeddingInputlayer` class is for FastText Embedding for sentence classification, see `[1] <http://arxiv.org/abs/1607.01759>`_.
661-
662-
Parameters
663-
------------
664-
inputs : input placeholder or tensor; zeros are paddings
665-
vocabulary_size : an integer, the size of vocabulary
666-
embedding_size : an integer, the dimension of embedding vectors
667-
name : a string, the name of the layer
668-
embeddings_initializer : the initializer of the embedding matrix
669-
embeddings_kwargs : kwargs to get embedding matrix variable
670-
671-
References
672-
------------
673-
- [1] Joulin, A., Grave, E., Bojanowski, P., & Mikolov, T. (2016).
674-
`Bag of Tricks for Efficient Text Classification. <http://arxiv.org/abs/1607.01759>`_
675-
- [2] Recht, B., Re, C., Wright, S., & Niu, F. (2011).
676-
`Hogwild: A Lock-Free Approach to Parallelizing Stochastic Gradient Descent. <https://arxiv.org/abs/1106.5730>`_
677-
In Advances in Neural Information Processing Systems 24 (pp. 693–701).
678-
- [3] `TensorFlow Candidate Sampling <https://www.tensorflow.org/api_guides/python/nn#Candidate_Sampling>`_
679-
"""
679+
embeddings_kwargs={}
680+
):#None):
680681
super().__init__(name=name)
681682

682683
if inputs.get_shape().ndims != 2:

0 commit comments

Comments
 (0)