Skip to content

Commit e406221

Browse files
committed
docstring fixed
1 parent e7b399a commit e406221

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

tensorlayer/layers/pooling.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class PoolLayer(Layer):
3131
The :class:`PoolLayer` class is a Pooling layer.
3232
You can choose ``tf.nn.max_pool`` and ``tf.nn.avg_pool`` for 2D input or
3333
``tf.nn.max_pool3d`` and ``tf.nn.avg_pool3d`` for 3D input.
34+
3435
Parameters
3536
----------
3637
filter_size : tuple of int
@@ -46,12 +47,15 @@ class PoolLayer(Layer):
4647
See `TensorFlow pooling APIs <https://tensorflow.google.cn/versions/r2.0/api_docs/python/tf/nn/>`__
4748
name : None or str
4849
A unique layer name.
50+
4951
Examples
5052
---------
5153
With TensorLayer
54+
5255
>>> net = tl.layers.Input([None, 50, 50, 32], name='input')
5356
>>> net = tl.layers.PoolLayer()(net)
5457
>>> output shape : [None, 25, 25, 32]
58+
5559
"""
5660

5761
def __init__(
@@ -93,6 +97,7 @@ def forward(self, inputs):
9397

9498
class MaxPool1d(Layer):
9599
"""Max pooling for 1D signal.
100+
96101
Parameters
97102
----------
98103
filter_size : int
@@ -105,12 +110,15 @@ class MaxPool1d(Layer):
105110
One of channels_last (default, [batch, length, channel]) or channels_first. The ordering of the dimensions in the inputs.
106111
name : None or str
107112
A unique layer name.
113+
108114
Examples
109115
---------
110116
With TensorLayer
117+
111118
>>> net = tl.layers.Input([None, 50, 32], name='input')
112119
>>> net = tl.layers.MaxPool1d(filter_size=3, strides=2, padding='SAME', name='maxpool1d')(net)
113120
>>> output shape : [None, 25, 32]
121+
114122
"""
115123

116124
def __init__(
@@ -174,6 +182,7 @@ def forward(self, inputs):
174182

175183
class MeanPool1d(Layer):
176184
"""Mean pooling for 1D signal.
185+
177186
Parameters
178187
------------
179188
filter_size : int
@@ -186,12 +195,15 @@ class MeanPool1d(Layer):
186195
One of channels_last (default, [batch, length, channel]) or channels_first. The ordering of the dimensions in the inputs.
187196
name : None or str
188197
A unique layer name.
198+
189199
Examples
190200
---------
191201
With TensorLayer
202+
192203
>>> net = tl.layers.Input([None, 50, 32], name='input')
193204
>>> net = tl.layers.MeanPool1d(filter_size=3, strides=2, padding='SAME')(net)
194205
>>> output shape : [None, 25, 32]
206+
195207
"""
196208

197209
def __init__(
@@ -256,6 +268,7 @@ def forward(self, inputs):
256268

257269
class MaxPool2d(Layer):
258270
"""Max pooling for 2D image.
271+
259272
Parameters
260273
-----------
261274
filter_size : tuple of int
@@ -268,12 +281,15 @@ class MaxPool2d(Layer):
268281
One of channels_last (default, [batch, height, width, channel]) or channels_first. The ordering of the dimensions in the inputs.
269282
name : None or str
270283
A unique layer name.
284+
271285
Examples
272286
---------
273287
With TensorLayer
288+
274289
>>> net = tl.layers.Input([None, 50, 50, 32], name='input')
275290
>>> net = tl.layers.MaxPool2d(filter_size=(3, 3), strides=(2, 2), padding='SAME')(net)
276291
>>> output shape : [None, 25, 25, 32]
292+
277293
"""
278294

279295
def __init__(
@@ -327,6 +343,7 @@ def forward(self, inputs):
327343

328344
class MeanPool2d(Layer):
329345
"""Mean pooling for 2D image [batch, height, width, channel].
346+
330347
Parameters
331348
-----------
332349
filter_size : tuple of int
@@ -339,12 +356,15 @@ class MeanPool2d(Layer):
339356
One of channels_last (default, [batch, height, width, channel]) or channels_first. The ordering of the dimensions in the inputs.
340357
name : None or str
341358
A unique layer name.
359+
342360
Examples
343361
---------
344362
With TensorLayer
363+
345364
>>> net = tl.layers.Input([None, 50, 50, 32], name='input')
346365
>>> net = tl.layers.MeanPool2d(filter_size=(3, 3), strides=(2, 2), padding='SAME')(net)
347366
>>> output shape : [None, 25, 25, 32]
367+
348368
"""
349369

350370
def __init__(
@@ -398,6 +418,7 @@ def forward(self, inputs):
398418

399419
class MaxPool3d(Layer):
400420
"""Max pooling for 3D volume.
421+
401422
Parameters
402423
------------
403424
filter_size : tuple of int
@@ -410,16 +431,20 @@ class MaxPool3d(Layer):
410431
One of channels_last (default, [batch, depth, height, width, channel]) or channels_first. The ordering of the dimensions in the inputs.
411432
name : None or str
412433
A unique layer name.
434+
413435
Returns
414436
-------
415437
:class:`tf.Tensor`
416438
A max pooling 3-D layer with a output rank as 5.
439+
417440
Examples
418441
---------
419442
With TensorLayer
443+
420444
>>> net = tl.layers.Input([None, 50, 50, 50, 32], name='input')
421445
>>> net = tl.layers.MaxPool3d(filter_size=(3, 3, 3), strides=(2, 2, 2), padding='SAME')(net)
422446
>>> output shape : [None, 25, 25, 25, 32]
447+
423448
"""
424449

425450
def __init__(
@@ -475,6 +500,7 @@ def forward(self, inputs):
475500

476501
class MeanPool3d(Layer):
477502
"""Mean pooling for 3D volume.
503+
478504
Parameters
479505
------------
480506
filter_size : tuple of int
@@ -487,16 +513,20 @@ class MeanPool3d(Layer):
487513
One of channels_last (default, [batch, depth, height, width, channel]) or channels_first. The ordering of the dimensions in the inputs.
488514
name : None or str
489515
A unique layer name.
516+
490517
Returns
491518
-------
492519
:class:`tf.Tensor`
493520
A mean pooling 3-D layer with a output rank as 5.
521+
494522
Examples
495523
---------
496524
With TensorLayer
525+
497526
>>> net = tl.layers.Input([None, 50, 50, 50, 32], name='input')
498527
>>> net = tl.layers.MeanPool3d(filter_size=(3, 3, 3), strides=(2, 2, 2), padding='SAME')(net)
499528
>>> output shape : [None, 25, 25, 25, 32]
529+
500530
"""
501531

502532
def __init__(
@@ -552,18 +582,22 @@ def forward(self, inputs):
552582

553583
class GlobalMaxPool1d(Layer):
554584
"""The :class:`GlobalMaxPool1d` class is a 1D Global Max Pooling layer.
585+
555586
Parameters
556587
------------
557588
data_format : str
558589
One of channels_last (default, [batch, length, channel]) or channels_first. The ordering of the dimensions in the inputs.
559590
name : None or str
560591
A unique layer name.
592+
561593
Examples
562594
---------
563595
With TensorLayer
596+
564597
>>> net = tl.layers.Input([None, 100, 30], name='input')
565598
>>> net = tl.layers.GlobalMaxPool1d()(net)
566599
>>> output shape : [None, 30]
600+
567601
"""
568602

569603
def __init__(
@@ -604,18 +638,22 @@ def forward(self, inputs):
604638

605639
class GlobalMeanPool1d(Layer):
606640
"""The :class:`GlobalMeanPool1d` class is a 1D Global Mean Pooling layer.
641+
607642
Parameters
608643
------------
609644
data_format : str
610645
One of channels_last (default, [batch, length, channel]) or channels_first. The ordering of the dimensions in the inputs.
611646
name : None or str
612647
A unique layer name.
648+
613649
Examples
614650
---------
615651
With TensorLayer
652+
616653
>>> net = tl.layers.Input([None, 100, 30], name='input')
617654
>>> net = tl.layers.GlobalMeanPool1d()(net)
618655
>>> output shape : [None, 30]
656+
619657
"""
620658

621659
def __init__(
@@ -655,18 +693,22 @@ def forward(self, inputs):
655693

656694
class GlobalMaxPool2d(Layer):
657695
"""The :class:`GlobalMaxPool2d` class is a 2D Global Max Pooling layer.
696+
658697
Parameters
659698
------------
660699
data_format : str
661700
One of channels_last (default, [batch, height, width, channel]) or channels_first. The ordering of the dimensions in the inputs.
662701
name : None or str
663702
A unique layer name.
703+
664704
Examples
665705
---------
666706
With TensorLayer
707+
667708
>>> net = tl.layers.Input([None, 100, 100, 30], name='input')
668709
>>> net = tl.layers.GlobalMaxPool2d()(net)
669710
>>> output shape : [None, 30]
711+
670712
"""
671713

672714
def __init__(
@@ -706,18 +748,22 @@ def forward(self, inputs):
706748

707749
class GlobalMeanPool2d(Layer):
708750
"""The :class:`GlobalMeanPool2d` class is a 2D Global Mean Pooling layer.
751+
709752
Parameters
710753
------------
711754
data_format : str
712755
One of channels_last (default, [batch, height, width, channel]) or channels_first. The ordering of the dimensions in the inputs.
713756
name : None or str
714757
A unique layer name.
758+
715759
Examples
716760
---------
717761
With TensorLayer
762+
718763
>>> net = tl.layers.Input([None, 100, 100, 30], name='input')
719764
>>> net = tl.layers.GlobalMeanPool2d()(net)
720765
>>> output shape : [None, 30]
766+
721767
"""
722768

723769
def __init__(
@@ -758,18 +804,22 @@ def forward(self, inputs):
758804

759805
class GlobalMaxPool3d(Layer):
760806
"""The :class:`GlobalMaxPool3d` class is a 3D Global Max Pooling layer.
807+
761808
Parameters
762809
------------
763810
data_format : str
764811
One of channels_last (default, [batch, depth, height, width, channel]) or channels_first. The ordering of the dimensions in the inputs.
765812
name : None or str
766813
A unique layer name.
814+
767815
Examples
768816
---------
769817
With TensorLayer
818+
770819
>>> net = tl.layers.Input([None, 100, 100, 100, 30], name='input')
771820
>>> net = tl.layers.GlobalMaxPool3d()(net)
772821
>>> output shape : [None, 30]
822+
773823
"""
774824

775825
def __init__(
@@ -810,18 +860,22 @@ def forward(self, inputs):
810860

811861
class GlobalMeanPool3d(Layer):
812862
"""The :class:`GlobalMeanPool3d` class is a 3D Global Mean Pooling layer.
863+
813864
Parameters
814865
------------
815866
data_format : str
816867
One of channels_last (default, [batch, depth, height, width, channel]) or channels_first. The ordering of the dimensions in the inputs.
817868
name : None or str
818869
A unique layer name.
870+
819871
Examples
820872
---------
821873
With TensorLayer
874+
822875
>>> net = tl.layers.Input([None, 100, 100, 100, 30], name='input')
823876
>>> net = tl.layers.GlobalMeanPool3d()(net)
824877
>>> output shape : [None, 30]
878+
825879
"""
826880

827881
def __init__(
@@ -861,19 +915,23 @@ def forward(self, inputs):
861915

862916
class CornerPool2d(Layer):
863917
"""Corner pooling for 2D image [batch, height, width, channel], see `here <https://arxiv.org/abs/1808.01244>`__.
918+
864919
Parameters
865920
----------
866921
mode : str
867922
TopLeft for the top left corner,
868923
Bottomright for the bottom right corner.
869924
name : None or str
870925
A unique layer name.
926+
871927
Examples
872928
---------
873929
With TensorLayer
930+
874931
>>> net = tl.layers.Input([None, 32, 32, 8], name='input')
875932
>>> net = tl.layers.CornerPool2d(mode='TopLeft',name='cornerpool2d')(net)
876933
>>> output shape : [None, 32, 32, 8]
934+
877935
"""
878936

879937
def __init__(

0 commit comments

Comments
 (0)