Skip to content

Commit 8818ee0

Browse files
authored
Merge pull request #2 from zsdonghao/master
a
2 parents 04f8f37 + fcfcac5 commit 8818ee0

File tree

3 files changed

+295
-263
lines changed

3 files changed

+295
-263
lines changed

docs/modules/layers.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ Layer list
269269
PadLayer
270270
UpSampling2dLayer
271271
DownSampling2dLayer
272+
DeformableConv2dLayer
272273
AtrousConv1dLayer
273274
AtrousConv2dLayer
274275

@@ -303,6 +304,11 @@ Layer list
303304

304305
RNNLayer
305306
BiRNNLayer
307+
308+
ConvRNNCell
309+
BasicConvLSTMCell
310+
ConvLSTMLayer
311+
306312
advanced_indexing_op
307313
retrieve_seq_length_op
308314
retrieve_seq_length_op2
@@ -458,6 +464,10 @@ Convolutional layer (Pro)
458464
^^^^^^^^^^^^^^^^^^^^^^^
459465
.. autoclass:: DownSampling2dLayer
460466

467+
2D Deformable Conv
468+
^^^^^^^^^^^^^^^^^^^^^^^
469+
.. autoclass:: DeformableConv2dLayer
470+
461471
1D Atrous convolution
462472
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
463473
.. autofunction:: AtrousConv1dLayer
@@ -608,6 +618,24 @@ Bidirectional layer
608618
.. autoclass:: BiRNNLayer
609619

610620

621+
622+
Recurrent Convolutional layer
623+
-------------------------------
624+
625+
Conv RNN Cell
626+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
627+
.. autoclass:: ConvRNNCell
628+
629+
Basic Conv LSTM Cell
630+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
631+
.. autoclass:: BasicConvLSTMCell
632+
633+
Conv LSTM layer
634+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
635+
.. autoclass:: ConvLSTMLayer
636+
637+
638+
611639
Advanced Ops for Dynamic RNN
612640
-------------------------------
613641
These operations usually be used inside Dynamic RNN layer, they can

example/tutorial_mnist.py

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ def main_test_layers(model='relu'):
6161
network = tl.layers.InputLayer(x, name='input')
6262
network = tl.layers.DropoutLayer(network, keep=0.8, name='drop1')
6363
network = tl.layers.DenseLayer(network, n_units=800,
64-
act = tf.nn.relu, name='relu1')
64+
act=tf.nn.relu, name='relu1')
6565
network = tl.layers.DropoutLayer(network, keep=0.5, name='drop2')
6666
network = tl.layers.DenseLayer(network, n_units=800,
67-
act = tf.nn.relu, name='relu2')
67+
act=tf.nn.relu, name='relu2')
6868
network = tl.layers.DropoutLayer(network, keep=0.5, name='drop3')
6969
network = tl.layers.DenseLayer(network, n_units=10,
70-
act = tf.identity,
70+
act=tf.identity,
7171
name='output')
7272
elif model == 'dropconnect':
7373
network = tl.layers.InputLayer(x, name='input')
@@ -79,7 +79,7 @@ def main_test_layers(model='relu'):
7979
name='dropconnect_relu2')
8080
network = tl.layers.DropconnectDenseLayer(network, keep = 0.5,
8181
n_units=10,
82-
act = tf.identity,
82+
act=tf.identity,
8383
name='output')
8484

8585
# To print all attributes of a Layer.
@@ -295,20 +295,18 @@ def main_test_stacked_denoise_AE(model='relu'):
295295
network = tl.layers.DropoutLayer(network, keep=0.5, name='denoising1')
296296
# 1st layer
297297
network = tl.layers.DropoutLayer(network, keep=0.8, name='drop1')
298-
network = tl.layers.DenseLayer(network, n_units=800, act = act, name=model+'1')
298+
network = tl.layers.DenseLayer(network, n_units=800, act=act, name=model+'1')
299299
x_recon1 = network.outputs
300300
recon_layer1 = tl.layers.ReconLayer(network, x_recon=x, n_units=784,
301-
act = act_recon, name='recon_layer1')
301+
act=act_recon, name='recon_layer1')
302302
# 2nd layer
303303
network = tl.layers.DropoutLayer(network, keep=0.5, name='drop2')
304304
network = tl.layers.DenseLayer(network, n_units=800, act = act, name=model+'2')
305305
recon_layer2 = tl.layers.ReconLayer(network, x_recon=x_recon1, n_units=800,
306-
act = act_recon, name='recon_layer2')
306+
act=act_recon, name='recon_layer2')
307307
# 3rd layer
308308
network = tl.layers.DropoutLayer(network, keep=0.5, name='drop3')
309-
network = tl.layers.DenseLayer(network, n_units=10,
310-
act = tf.identity,
311-
name='output')
309+
network = tl.layers.DenseLayer(network, 10, act=tf.identity, name='output')
312310

313311
# Define fine-tune process
314312
y = network.outputs
@@ -485,23 +483,20 @@ def main_test_cnn_layer():
485483
# pool = tf.nn.max_pool,
486484
# name ='pool2',) # output: (?, 7, 7, 64)
487485
## Simplified conv API for beginner (the same with the above layers)
488-
network = tl.layers.Conv2d(network, n_filter=32, filter_size=(5, 5), strides=(1, 1),
486+
network = tl.layers.Conv2d(network, 32, (5, 5), (1, 1),
489487
act=tf.nn.relu, padding='SAME', name='cnn1')
490-
network = tl.layers.MaxPool2d(network, filter_size=(2, 2), strides=(2, 2),
488+
network = tl.layers.MaxPool2d(network, (2, 2), (2, 2),
491489
padding='SAME', name='pool1')
492-
network = tl.layers.Conv2d(network, n_filter=64, filter_size=(5, 5), strides=(1, 1),
490+
network = tl.layers.Conv2d(network, 64, (5, 5), (1, 1),
493491
act=tf.nn.relu, padding='SAME', name='cnn2')
494-
network = tl.layers.MaxPool2d(network, filter_size=(2, 2), strides=(2, 2),
492+
network = tl.layers.MaxPool2d(network, (2, 2), (2, 2),
495493
padding='SAME', name='pool2')
496494
## end of conv
497495
network = tl.layers.FlattenLayer(network, name='flatten')
498496
network = tl.layers.DropoutLayer(network, keep=0.5, name='drop1')
499-
network = tl.layers.DenseLayer(network, n_units=256,
500-
act = tf.nn.relu, name='relu1')
497+
network = tl.layers.DenseLayer(network, 256, act=tf.nn.relu, name='relu1')
501498
network = tl.layers.DropoutLayer(network, keep=0.5, name='drop2')
502-
network = tl.layers.DenseLayer(network, n_units=10,
503-
act = tf.identity,
504-
name='output')
499+
network = tl.layers.DenseLayer(network, 10, act=tf.identity, name='output')
505500

506501
y = network.outputs
507502

0 commit comments

Comments
 (0)