(im_size, n_chan, n_feature, n_extra_layers,
                            batch_norm, finact)
return layers
Create DC-GAN discriminator network

    Arguments:
        im_size (int): Image size
        n_chan (int): Number of color channels
        n_feature (int): Base number of features
        n_extra_layers (int): Number of extra convolution layers
        batch_norm(bool): Enable batch normalization
        finact (object): Final activation function
Create DC-GAN discriminator network
Create DC - GAN discriminator network
def create_dc_discriminator(im_size, n_chan, n_feature, n_extra_layers,
                            batch_norm, finact):
    """
    Create DC-GAN discriminator network

    Arguments:
        im_size (int): Image size
        n_chan (int): Number of color channels
        n_feature (int): Base number of features
        n_extra_layers (int): Number of extra convolution layers
        batch_norm(bool): Enable batch normalization
        finact (object): Final activation function
    """
    assert im_size % 16 == 0, "im_size has to be a multiple of 16"

    _is = im_size // 2
    _nf = n_feature  # image size and number of features

    layers = []
    lname = 'dis.initial.{0}-{1}'.format(n_chan, _nf)
    layers.append(conv_layer(lname, _nf, batch_norm=False))
    for _t in range(n_extra_layers):
        lname = 'dis.extra-layer-{0}.{1}'.format(_t, _nf)
        layers.append(conv_layer(lname, _nf, ker_size=3, strides=1, batch_norm=batch_norm))
    while _is > 4:
        lname = 'dis.pyramid.{0}-{1}'.format(_nf, _nf*2)
        layers.append(conv_layer(lname, _nf*2, batch_norm=batch_norm))
        _is, _nf = _is//2, _nf*2
    lname = 'dis.final.{0}-{1}'.format(_nf, 1)
    layers.append(conv_layer(lname, 1, strides=1, padding=0, activation=finact, batch_norm=False))
    return layers
def create_dc_discriminator ( im_size , n_chan , n_feature , n_extra_layers , batch_norm , finact ) : assert im_size % 16 == 0 , "im_size has to be a multiple of 16" _is = im_size // 2 _nf = n_feature # image size and number of features layers = [ ] lname = 'dis.initial.{0}-{1}' . format ( n_chan , _nf ) layers . append ( conv_layer ( lname , _nf , batch_norm = False ) ) for _t in range ( n_extra_layers ) : lname = 'dis.extra-layer-{0}.{1}' . format ( _t , _nf ) layers . append ( conv_layer ( lname , _nf , ker_size = 3 , strides = 1 , batch_norm = batch_norm ) ) while _is > 4 : lname = 'dis.pyramid.{0}-{1}' . format ( _nf , _nf * 2 ) layers . append ( conv_layer ( lname , _nf * 2 , batch_norm = batch_norm ) ) _is , _nf = _is // 2 , _nf * 2 lname = 'dis.final.{0}-{1}' . format ( _nf , 1 ) layers . append ( conv_layer ( lname , 1 , strides = 1 , padding = 0 , activation = finact , batch_norm = False ) ) return layers