(im_size, n_chan, n_feature, depth, batch_norm, finact)
return layers
Create MLP generator network

    Arguments:
        im_size (int): Image size
        n_chan (int): Number of color channels
        n_feature (int): Base number of features
        depth (int): Depth of network
        batch_norm(bool): Enable batch normalization
        finact (object): Final activation function
Create MLP generator network
Create MLP generator network
def create_mlp_generator(im_size, n_chan, n_feature, depth, batch_norm, finact):
    """
    Create MLP generator network

    Arguments:
        im_size (int): Image size
        n_chan (int): Number of color channels
        n_feature (int): Base number of features
        depth (int): Depth of network
        batch_norm(bool): Enable batch normalization
        finact (object): Final activation function
    """
    assert depth > 1, "depth of the MLP has to be at least 2"
    layers = []
    for i in range(depth-1):
        lname = 'gen-{0}.{1}'.format(i, n_feature)
        layers.append(mlp_layer(lname, n_feature, batch_norm=batch_norm))
    lname = 'gen-{0}.{1}-{2}'.format(depth-1, n_feature, n_chan*im_size*im_size)
    layers.append(mlp_layer(lname, n_chan*im_size*im_size, activation=finact,
                            batch_norm=batch_norm))
    lname = 'gen-final'
    layers.append(Reshape(name=lname, reshape=(n_chan, im_size, im_size)))
    return layers
def create_mlp_generator ( im_size , n_chan , n_feature , depth , batch_norm , finact ) : assert depth > 1 , "depth of the MLP has to be at least 2" layers = [ ] for i in range ( depth - 1 ) : lname = 'gen-{0}.{1}' . format ( i , n_feature ) layers . append ( mlp_layer ( lname , n_feature , batch_norm = batch_norm ) ) lname = 'gen-{0}.{1}-{2}' . format ( depth - 1 , n_feature , n_chan * im_size * im_size ) layers . append ( mlp_layer ( lname , n_chan * im_size * im_size , activation = finact , batch_norm = batch_norm ) ) lname = 'gen-final' layers . append ( Reshape ( name = lname , reshape = ( n_chan , im_size , im_size ) ) ) return layers