Skip to content

Commit a72898f

Browse files
committed
Fid Docs : note -> notes, variables -> attributes, code ref --> refs
1 parent c166185 commit a72898f

File tree

5 files changed

+28
-30
lines changed

5 files changed

+28
-30
lines changed

tensorlayer/files.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,9 @@ def load_ptb_dataset(path='data/ptb/'):
220220
--------
221221
>>> train_data, valid_data, test_data, vocab_size = tl.files.load_ptb_dataset()
222222
223-
Code References
223+
References
224224
---------------
225225
- ``tensorflow.models.rnn.ptb import reader``
226-
227-
Download Links
228-
---------------
229226
- `Manual download <http://www.fit.vutbr.cz/~imikolov/rnnlm/simple-examples.tgz>`_
230227
"""
231228
print("Load or Download Penn TreeBank (PTB) dataset > {}".format(path))
@@ -1213,7 +1210,7 @@ def natural_keys(text):
12131210
>>> l.sort() # that is what we dont want
12141211
... ['im03.jpg', 'im05', 'im1.jpg', 'im11.jpg', 'im21.jpg', 'im31.jpg']
12151212
1216-
Reference
1213+
References
12171214
----------
12181215
alist.sort(key=natural_keys) sorts in human order
12191216
http://nedbatchelder.com/blog/200712/human_sorting.html

tensorlayer/iterate.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ def minibatches(inputs=None, targets=None, batch_size=None, shuffle=False):
2121
shuffle : boolean
2222
Indicating whether to use a shuffling queue, shuffle the dataset before return.
2323
24-
Hints
25-
-------
26-
- If you have two inputs, e.g. X1 (1000, 100) and X2 (1000, 80), you can ``np.hstack((X1, X2))
27-
into (1000, 180) and feed into ``inputs``, then you can split a batch of X1 and X2.
28-
2924
Examples
3025
--------
3126
>>> X = np.asarray([['a','a'], ['b','b'], ['c','c'], ['d','d'], ['e','e'], ['f','f']])
@@ -41,6 +36,12 @@ def minibatches(inputs=None, targets=None, batch_size=None, shuffle=False):
4136
... (array([['e', 'e'],
4237
... ['f', 'f']],
4338
... dtype='<U1'), array([4, 5]))
39+
40+
41+
Notes
42+
-------
43+
- If you have two inputs, e.g. X1 (1000, 100) and X2 (1000, 80), you can ``np.hstack((X1, X2))
44+
into (1000, 180) and feed into ``inputs``, then you can split a batch of X1 and X2.
4445
"""
4546
assert len(inputs) == len(targets)
4647
if shuffle:

tensorlayer/layers.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ class Word2vecEmbeddingInputlayer(Layer):
410410
name : a string or None
411411
An optional name to attach to this layer.
412412
413-
Variables
413+
Attributes
414414
--------------
415415
nce_cost : a tensor
416416
The NCE loss.
@@ -543,7 +543,7 @@ class EmbeddingInputlayer(Layer):
543543
name : a string or None
544544
An optional name to attach to this layer.
545545
546-
Variables
546+
Attributes
547547
------------
548548
outputs : a tensor
549549
The outputs of embedding layer.
@@ -3777,7 +3777,7 @@ class RNNLayer(Layer):
37773777
name : a string or None
37783778
An optional name to attach to this layer.
37793779
3780-
Variables
3780+
Attributes
37813781
--------------
37823782
outputs : a tensor
37833783
The output of this RNN.
@@ -4044,7 +4044,7 @@ class BiRNNLayer(Layer):
40444044
name : a string or None
40454045
An optional name to attach to this layer.
40464046
4047-
Variables
4047+
Attributes
40484048
--------------
40494049
outputs : a tensor
40504050
The output of this RNN.
@@ -4634,7 +4634,7 @@ class BiDynamicRNNLayer(Layer):
46344634
The number of hidden units in the layer.
46354635
initializer : initializer
46364636
The initializer for initializing the parameters.
4637-
sequence_length : a tensor, array or None
4637+
sequence_length : a tensor, array or None.
46384638
The sequence length of each row of input data, see ``Advanced Ops for Dynamic RNN``.
46394639
- If None, it uses ``retrieve_seq_length_op`` to compute the sequence_length, i.e. when the features of padding (on right hand side) are all zeros.
46404640
- If using word embedding, you may need to compute the sequence_length from the ID array (the integer features before word embedding) by using ``retrieve_seq_length_op2`` or ``retrieve_seq_length_op``.
@@ -4659,7 +4659,7 @@ class BiDynamicRNNLayer(Layer):
46594659
name : a string or None
46604660
An optional name to attach to this layer.
46614661
4662-
Variables
4662+
Attributes
46634663
-----------------------
46644664
outputs : a tensor
46654665
The output of this RNN.
@@ -4902,7 +4902,7 @@ class Seq2Seq(Layer):
49024902
name : a string or None
49034903
An optional name to attach to this layer.
49044904
4905-
Variables
4905+
Attributes
49064906
------------
49074907
outputs : a tensor
49084908
The output of RNN decoder.

tensorlayer/nlp.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class Vocabulary(object):
201201
end_word : Special word denoting sentence end.
202202
unk_word : Special word denoting unknown words.
203203
204-
Properties
204+
Attributes
205205
------------
206206
vocab : a dictionary from word to id.
207207
reverse_vocab : a list from id to word.
@@ -338,9 +338,9 @@ def create_vocab(sentences, word_counts_output_file, min_word_count=1):
338338
--------
339339
- tl.nlp.SimpleVocabulary object.
340340
341-
Mores
342-
-----
343-
- ``tl.nlp.build_vocab()``
341+
Notes
342+
-------
343+
- See more ``tl.nlp.build_vocab()``
344344
345345
Examples
346346
--------
@@ -428,7 +428,7 @@ def read_words(filename="nietzsche.txt", replace = ['\n', '<eos>']):
428428
The context in a list, split by space by default, and use ``<eos>`` to represent ``\\n``,
429429
e.g. ``[... 'how', 'useful', 'it', "'s" ... ]``.
430430
431-
Code References
431+
References
432432
---------------
433433
- `tensorflow.models.rnn.ptb.reader <https://github.com/tensorflow/tensorflow/tree/master/tensorflow/models/rnn/ptb>`_
434434
"""
@@ -520,7 +520,7 @@ def build_vocab(data):
520520
word_to_id : a dictionary
521521
mapping words to unique IDs. e.g. {'campbell': 2587, 'atlantic': 2247, 'aoun': 6746 .... }
522522
523-
Code References
523+
References
524524
---------------
525525
- `tensorflow.models.rnn.ptb.reader <https://github.com/tensorflow/tensorflow/tree/master/tensorflow/models/rnn/ptb>`_
526526
@@ -594,7 +594,7 @@ def build_words_dataset(words=[], vocabulary_size=50000, printable=True, unk_key
594594
>>> vocabulary_size = 50000
595595
>>> data, count, dictionary, reverse_dictionary = tl.nlp.build_words_dataset(words, vocabulary_size)
596596
597-
Code References
597+
References
598598
-----------------
599599
- `tensorflow/examples/tutorials/word2vec/word2vec_basic.py <https://github.com/tensorflow/tensorflow/blob/r0.7/tensorflow/examples/tutorials/word2vec/word2vec_basic.py>`_
600600
"""
@@ -653,7 +653,7 @@ def words_to_word_ids(data=[], word_to_id={}, unk_key = 'UNK'):
653653
>>> print(context)
654654
... [b'hello', b'how', b'are', b'you']
655655
656-
Code References
656+
References
657657
---------------
658658
- `tensorflow.models.rnn.ptb.reader <https://github.com/tensorflow/tensorflow/tree/master/tensorflow/models/rnn/ptb>`_
659659
"""

tensorlayer/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ def fit(sess, network, train_op, cost, X_train, y_train, x, y_, acc=None, batch_
6767
... X_val=X_val, y_val=y_val, eval_train=False,
6868
... tensorboard=True, tensorboard_weight_histograms=True, tensorboard_graph_vis=True)
6969
70-
Note
70+
Notes
7171
--------
72-
If tensorboard=True, the global_variables_initializer will be run inside the fit function
73-
in order to initalize the automatically generated summary nodes used for tensorboard visualization,
74-
thus tf.global_variables_initializer().run() before the fit() call will be undefined.
72+
If tensorboard=True, the global_variables_initializer will be run inside the fit function
73+
in order to initalize the automatically generated summary nodes used for tensorboard visualization,
74+
thus tf.global_variables_initializer().run() before the fit() call will be undefined.
7575
"""
7676
assert X_train.shape[0] >= batch_size, "Number of training examples should be bigger than the batch size"
7777

@@ -130,7 +130,7 @@ def fit(sess, network, train_op, cost, X_train, y_train, x, y_, acc=None, batch_
130130
result = sess.run(merged, feed_dict=feed_dict)
131131
train_writer.add_summary(result, tensorboard_train_index)
132132
tensorboard_train_index += 1
133-
if (X_val is not None) and (y_val is not None):
133+
if (X_val is not None) and (y_val is not None):
134134
for X_val_a, y_val_a in iterate.minibatches(
135135
X_val, y_val, batch_size, shuffle=True):
136136
dp_dict = dict_to_one( network.all_drop ) # disable noise layers

0 commit comments

Comments
 (0)