예제 #1
0
                                 d_error.mean(),
                                 g_fake_error.mean(),
                                 fake_data.mean(),
                                 fake_data.std())

if __name__ == '__main__':
    basic_config = {
        'g': {
            'in_size': 1,
            'hidden_size': 50,
            'out_size': 1,
            'learning_rate': 2e-3,
            'betas': (0.9, 0.999),
        },
        'd': {
            'in_size': 1,
            'hidden_size': 50,
            'out_size': 1,
            'learning_rate': 2e-3,
            'betas': (0.9, 0.999),
        },
        'd_steps': 1,
        'g_steps': 1,
        'batch_size': 100,
        'num_epoch': 1000,
        'print_interval': 100,
    }

    gan = VanillaGAN(structuralize('config', **basic_config))
    gan.train()
예제 #2
0
파일: lsgan.py 프로젝트: sighingnow/gan
    if opt.cuda:
        try:
            device = 'cuda:%d' % (find_gpu(1)[0])
        except:
            logger.warning('CUDA device is unavailable, fall back to CPU')
            device = 'cpu'
    else:
        device = 'cpu'

    basic_config = {
        'g': {
            'in_channels': 100,
            'learning_rate': 2e-4,
            'betas': (0.5, 0.999),
        },
        'd': {
            'learning_rate': 2e-4,
            'betas': (0.5, 0.999),
        },
        'device': device,
        'batch_size': 64,
        'num_epoch': 10,
        'print_interval': 5,
        'verbose': opt.verbose,
        'datadir': 'dataset/data/mnist',
    }

    gan = LSGAN(structuralize('config', **basic_config), logger)
    gan.train()