Skip to content

Commit a7e29dd

Browse files
authored
Merge pull request #439 from tensorlayer/globalpool3d
release globalpool3d layers
2 parents fea6bd1 + 7c68e34 commit a7e29dd

File tree

4 files changed

+112
-162
lines changed

4 files changed

+112
-162
lines changed

docs/modules/layers.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ Layer list
279279
GlobalMeanPool1d
280280
GlobalMaxPool2d
281281
GlobalMeanPool2d
282+
GlobalMaxPool3d
283+
GlobalMeanPool3d
282284

283285
SubpixelConv1d
284286
SubpixelConv2d
@@ -603,6 +605,14 @@ Pooling layer for any dimensions and any pooling functions.
603605
^^^^^^^^^^^^^^^^^^^^^^^^^^
604606
.. autoclass:: GlobalMeanPool2d
605607

608+
3D Global Max pooling
609+
^^^^^^^^^^^^^^^^^^^^^^^^^^
610+
.. autoclass:: GlobalMaxPool3d
611+
612+
3D Global Mean pooling
613+
^^^^^^^^^^^^^^^^^^^^^^^^^^
614+
.. autoclass:: GlobalMeanPool3d
615+
606616

607617
Normalization layer
608618
--------------------

tensorlayer/layers/padding.py

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -137,92 +137,3 @@ def __init__(
137137
logging.info("ZeroPad3d %s: padding:%s" % (self.name, str(padding)))
138138
self.outputs = tf.keras.layers.ZeroPadding3D(padding=padding, name=name)(self.inputs)
139139
self.all_layers.append(self.outputs)
140-
141-
142-
class ZeroPad1d(Layer):
143-
"""
144-
The :class:`ZeroPad1d` class is a 1D padding layer for signal [batch, length, channel].
145-
146-
Parameters
147-
----------
148-
layer : :class:`Layer`
149-
The previous layer.
150-
padding : int, or tuple of 2 ints
151-
- If int, zeros to add at the beginning and end of the padding dimension (axis 1).
152-
- If tuple of 2 ints, zeros to add at the beginning and at the end of the padding dimension.
153-
name : str
154-
A unique layer name.
155-
156-
"""
157-
158-
def __init__(
159-
self,
160-
prev_layer,
161-
padding,
162-
name='zeropad1d',
163-
):
164-
Layer.__init__(self, prev_layer=prev_layer, name=name)
165-
self.inputs = prev_layer.outputs
166-
logging.info("ZeroPad1d %s: padding:%s" % (self.name, str(padding)))
167-
self.outputs = tf.keras.layers.ZeroPadding1D(padding=padding, name=name)(self.inputs)
168-
self.all_layers.append(self.outputs)
169-
170-
171-
class ZeroPad2d(Layer):
172-
"""
173-
The :class:`ZeroPad2d` class is a 2D padding layer for image [batch, height, width, channel].
174-
175-
Parameters
176-
----------
177-
layer : :class:`Layer`
178-
The previous layer.
179-
padding : int, or tuple of 2 ints, or tuple of 2 tuples of 2 ints.
180-
- If int, the same symmetric padding is applied to width and height.
181-
- If tuple of 2 ints, interpreted as two different symmetric padding values for height and width as ``(symmetric_height_pad, symmetric_width_pad)``.
182-
- If tuple of 2 tuples of 2 ints, interpreted as ``((top_pad, bottom_pad), (left_pad, right_pad))``.
183-
name : str
184-
A unique layer name.
185-
186-
"""
187-
188-
def __init__(
189-
self,
190-
prev_layer,
191-
padding,
192-
name='zeropad2d',
193-
):
194-
Layer.__init__(self, prev_layer=prev_layer, name=name)
195-
self.inputs = prev_layer.outputs
196-
logging.info("ZeroPad2d %s: padding:%s" % (self.name, str(padding)))
197-
self.outputs = tf.keras.layers.ZeroPadding2D(padding=padding, name=name)(self.inputs)
198-
self.all_layers.append(self.outputs)
199-
200-
201-
class ZeroPad3d(Layer):
202-
"""
203-
The :class:`ZeroPad3d` class is a 3D padding layer for volume [batch, height, width, depth, channel].
204-
205-
Parameters
206-
----------
207-
layer : :class:`Layer`
208-
The previous layer.
209-
padding : int, or tuple of 2 ints, or tuple of 2 tuples of 2 ints.
210-
- If int, the same symmetric padding is applied to width and height.
211-
- If tuple of 2 ints, interpreted as two different symmetric padding values for height and width as ``(symmetric_dim1_pad, symmetric_dim2_pad, symmetric_dim3_pad)``.
212-
- If tuple of 2 tuples of 2 ints, interpreted as ``((left_dim1_pad, right_dim1_pad), (left_dim2_pad, right_dim2_pad), (left_dim3_pad, right_dim3_pad))``.
213-
name : str
214-
A unique layer name.
215-
216-
"""
217-
218-
def __init__(
219-
self,
220-
prev_layer,
221-
padding,
222-
name='zeropad3d',
223-
):
224-
Layer.__init__(self, prev_layer=prev_layer, name=name)
225-
self.inputs = prev_layer.outputs
226-
logging.info("ZeroPad3d %s: padding:%s" % (self.name, str(padding)))
227-
self.outputs = tf.keras.layers.ZeroPadding3D(padding=padding, name=name)(self.inputs)
228-
self.all_layers.append(self.outputs)

0 commit comments

Comments
 (0)