def PG_GAN(G,D,latent_size,label_size,resolution,num_channels): print("Latent size:") print(latent_size) print("Label size:") print(label_size) #inputs = [Input(shape=[latent_size], name='GANlatents')] #if label_size: # inputs += [Input(shape=[label_size], name='GANlabels')] #fake = G(inputs) #GAN_out = D(fake) #G_train = Model(inputs = inputs,outputs = [GAN_out],name = "PG_GAN") G_train = Sequential([G, D]) G_train.cur_lod = G.cur_lod shape = D.get_input_shape_at(0)[1:] gen_input, real_input, interpolation = Input(shape), Input(shape), Input(shape) sub = Subtract()([D(gen_input), D(real_input)]) norm = GradNorm()([D(interpolation), interpolation]) D_train = Model([gen_input, real_input, interpolation], [sub, norm]) D_train.cur_lod = D.cur_lod return G_train,D_train
def PG_GAN(G, D, label_size, resolution, num_channels): print("Label size:") print(label_size) G_train = Sequential([G, D]) G_train.cur_lod = G.cur_lod shape = D.get_input_shape_at(0)[1:] gen_input, real_input, interpolation = Input(shape), Input(shape), Input(shape) sub = Subtract()([D(gen_input), D(real_input)]) norm = GradNorm()([D(interpolation), interpolation]) D_train = Model([gen_input, real_input, interpolation], [sub, norm]) D_train.cur_lod = D.cur_lod return G_train, D_train