def __init__(self, in_channels, out_channels, mode='none', activation=F.leaky_relu, bn=False, dr=None):
    super(SNConvBlock, self).__init__()
    initializer = chainer.initializers.GlorotUniform()
    self.activation = activation
    self.bn = bn
    self.dr = dr
    with self.init_scope():
        if (mode == 'none'):
            self.c = SNConvolution2D(in_channels, out_channels, ksize=3, stride=1, pad=1, initialW=initializer, nobias=bn)
        elif (mode == 'none-7'):
            self.c = SNConvolution2D(in_channels, out_channels, ksize=(7, 7), stride=1, pad=(3, 3), initialW=initializer, nobias=bn)
        elif (mode == 'down'):
            self.c = SNConvolution2D(in_channels, out_channels, ksize=4, stride=2, pad=1, initialW=initializer, nobias=bn)
        elif (mode == 'up'):
            self.c = SNDeconvolution2D(in_channels, out_channels, ksize=4, stride=2, pad=1, initialW=initializer, nobias=bn)
        elif (mode == 'full-down'):
            self.c = SNConvolution2D(in_channels, out_channels, ksize=4, stride=1, pad=0, initialW=initializer, nobias=bn)
        elif (mode == 'frq'):
            self.c = SNConvolution2D(in_channels, out_channels, ksize=(1, 9), stride=1, pad=(0, 4), initialW=initializer, nobias=bn)
        elif (mode == 'frq-down'):
            self.c = SNConvolution2D(in_channels, out_channels, ksize=(1, 9), stride=1, pad=(0, 4), initialW=initializer, nobias=bn)
            self.activation = (lambda x: activation(_downsample(x)))
        elif (mode == 'frq-up'):
            self.c = SNConvolution2D(in_channels, out_channels, ksize=(1, 9), stride=1, pad=(0, 4), initialW=initializer, nobias=bn)
            self.activation = (lambda x: activation(_upsample(x)))
        else:
            raise Exception('mode is missing')
        if bn:
            self.b = L.BatchNormalization(out_channels)
def __init__(self, in_channels, out_channels, mode='none', activation=F.leaky_relu, bn=False, dr=None):
    super(SNConvBlock, self).__init__()
    initializer = chainer.initializers.GlorotUniform()
    self.activation = activation
    self.bn = bn
    self.dr = dr
    with self.init_scope():
        if (mode == 'none'):
            self.c = SNConvolution2D(in_channels, out_channels, ksize=3, stride=1, pad=1, initialW=initializer, nobias=bn)
        elif (mode == 'none-7'):
            self.c = SNConvolution2D(in_channels, out_channels, ksize=(7, 7), stride=1, pad=(3, 3), initialW=initializer, nobias=bn)
        elif (mode == 'down'):
            self.c = SNConvolution2D(in_channels, out_channels, ksize=4, stride=2, pad=1, initialW=initializer, nobias=bn)
        elif (mode == 'up'):
            self.c = SNDeconvolution2D(in_channels, out_channels, ksize=4, stride=2, pad=1, initialW=initializer, nobias=bn)
        elif (mode == 'full-down'):
            self.c = SNConvolution2D(in_channels, out_channels, ksize=4, stride=1, pad=0, initialW=initializer, nobias=bn)
        elif (mode == 'frq'):
            self.c = SNConvolution2D(in_channels, out_channels, ksize=(1, 9), stride=1, pad=(0, 4), initialW=initializer, nobias=bn)
        elif (mode == 'frq-down'):
            self.c = SNConvolution2D(in_channels, out_channels, ksize=(1, 9), stride=1, pad=(0, 4), initialW=initializer, nobias=bn)
            self.activation = (lambda x: activation(_downsample(x)))
        elif (mode == 'frq-up'):
            self.c = SNConvolution2D(in_channels, out_channels, ksize=(1, 9), stride=1, pad=(0, 4), initialW=initializer, nobias=bn)
            self.activation = (lambda x: activation(_upsample(x)))
        else:
            raise Exception('mode is missing')
        if bn:
            self.b = L.BatchNormalization(out_channels)