def __init__(self, kernel_size=7):
    super(SpatialAttention, self).__init__()
    assert (kernel_size in (3, 7)), 'kernel size must be 3 or 7'
    padding = (3 if (kernel_size == 7) else 1)
    self.conv1 = nn.Conv2d(2, 1, kernel_size, padding=padding, bias=False)
    self.sigmoid = nn.Sigmoid()
def __init__(self, kernel_size=7):
    super(SpatialAttention, self).__init__()
    assert (kernel_size in (3, 7)), 'kernel size must be 3 or 7'
    padding = (3 if (kernel_size == 7) else 1)
    self.conv1 = nn.Conv2d(2, 1, kernel_size, padding=padding, bias=False)
    self.sigmoid = nn.Sigmoid()