conf.generator_shared_hidden_units = [1000] conf.generator_hidden_units = [1000] conf.generator_activation_function = "elu" conf.generator_apply_dropout = False conf.generator_apply_batchnorm = False conf.generator_apply_batchnorm_to_input = False conf.decoder_hidden_units = [1000, 1000] conf.decoder_activation_function = "elu" conf.decoder_apply_dropout = False conf.decoder_apply_batchnorm = False conf.decoder_apply_batchnorm_to_input = False conf.discriminator_z_hidden_units = [1000, 1000] conf.discriminator_z_activation_function = "elu" conf.discriminator_z_apply_dropout = False conf.discriminator_z_apply_batchnorm = False conf.discriminator_z_apply_batchnorm_to_input = False conf.discriminator_y_hidden_units = [1000, 1000] conf.discriminator_y_activation_function = "elu" conf.discriminator_y_apply_dropout = False conf.discriminator_y_apply_batchnorm = False conf.discriminator_y_apply_batchnorm_to_input = False conf.q_z_x_type = aae.Q_Z_X_TYPE_GAUSSIAN aae = AAE(conf, name="aae") aae.load(args.model_dir)
if config.distribution_z == "deterministic": generator_z.add(Linear(None, config.ndim_z)) elif config.distribution_z == "gaussian": generator_z.add(Gaussian(None, config.ndim_z)) # outputs mean and ln(var) else: raise Exception() generator_y = Sequential() generator_y.add(Linear(None, config.ndim_y)) params = { "config": config.to_dict(), "decoder": decoder.to_dict(), "generator_shared": generator_shared.to_dict(), "generator_z": generator_z.to_dict(), "generator_y": generator_y.to_dict(), "discriminator_y": discriminator_y.to_dict(), "discriminator_z": discriminator_z.to_dict(), } with open(model_filename, "w") as f: json.dump(params, f, indent=4, sort_keys=True, separators=(',', ': ')) aae = AAE(params) aae.load(args.model_dir) if args.gpu_device != -1: cuda.get_device(args.gpu_device).use() aae.to_gpu()