File size: 474 Bytes
32408ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""Spatial pooling layers"""

from torch import nn

from . import functional as LF


class SmoothingAvgPooling(nn.Module):
    """Average pooling that smoothens the feature map, keeping its size

    :param int kernel_size: Kernel size of given pooling (e.g. 3)
    """

    def __init__(self, kernel_size):
        super().__init__()
        self.kernel_size = kernel_size

    def forward(self, x):
        return LF.smoothing_avg_pooling(x, kernel_size=self.kernel_size)