def get_netG():
    """Get net G"""
    # build the generator
    netG = nn.Sequential()
    with netG.name_scope():
        # input is Z, going into a convolution
        netG.add(nn.Conv2DTranspose(ngf * 8, 4, 1, 0, use_bias=False))
        netG.add(nn.BatchNorm())
        netG.add(nn.Activation('relu'))
        # state size. (ngf*8) x 4 x 4
        netG.add(nn.Conv2DTranspose(ngf * 4, 4, 2, 1, use_bias=False))
        netG.add(nn.BatchNorm())
        netG.add(nn.Activation('relu'))
        # state size. (ngf*4) x 8 x 8
        netG.add(nn.Conv2DTranspose(ngf * 2, 4, 2, 1, use_bias=False))
        netG.add(nn.BatchNorm())
        netG.add(nn.Activation('relu'))
        # state size. (ngf*2) x 16 x 16
        netG.add(nn.Conv2DTranspose(ngf, 4, 2, 1, use_bias=False))
        netG.add(nn.BatchNorm())
        netG.add(nn.Activation('relu'))
        # state size. (ngf) x 32 x 32
        netG.add(nn.Conv2DTranspose(nc, 4, 2, 1, use_bias=False))
        netG.add(nn.Activation('tanh'))
        # state size. (nc) x 64 x 64

    return netG
def get_netG ( ) : netG = nn . Sequential ( ) with netG . name_scope ( ) : netG . add ( nn . Conv2DTranspose ( ngf * 8 , 4 , 1 , 0 , use_bias = False ) ) netG . add ( nn . BatchNorm ( ) ) netG . add ( nn . Activation ( 'relu' ) ) netG . add ( nn . Conv2DTranspose ( ngf * 4 , 4 , 2 , 1 , use_bias = False ) ) netG . add ( nn . BatchNorm ( ) ) netG . add ( nn . Activation ( 'relu' ) ) netG . add ( nn . Conv2DTranspose ( ngf * 2 , 4 , 2 , 1 , use_bias = False ) ) netG . add ( nn . BatchNorm ( ) ) netG . add ( nn . Activation ( 'relu' ) ) netG . add ( nn . Conv2DTranspose ( ngf , 4 , 2 , 1 , use_bias = False ) ) netG . add ( nn . BatchNorm ( ) ) netG . add ( nn . Activation ( 'relu' ) ) netG . add ( nn . Conv2DTranspose ( nc , 4 , 2 , 1 , use_bias = False ) ) netG . add ( nn . Activation ( 'tanh' ) ) return netG
Get net G