Beispiel #1
0
 def _build_discriminator(self):
     x = Input(shape=self.data_shape, name='data')
     d = render_gan_discriminator(x,
                                  n=self.discriminator_units,
                                  conv_repeat=self.discriminator_depth,
                                  dense=[512])
     self.discriminator = Model([x], [d])
Beispiel #2
0
def test_render_gan_discriminator():
    fake_shape = (10, 1, 64, 64)
    real_shape = (10, 1, 64, 64)
    fake = Input(batch_shape=fake_shape)
    real = Input(batch_shape=real_shape)
    output = render_gan_discriminator([fake, real])
    model = Model([fake, real], output)
    model.compile('adam', 'mse')
    f = np.random.sample(fake_shape)
    r = np.random.sample(real_shape)
    y = np.random.sample((fake_shape[0], 1,))
    # TODO: fix different batch sizes for input and output
    # y = np.random.sample((fake_shape[0] + real_shape[0], 1,))
    with pytest.raises(ValueError):
        model.train_on_batch([f, r], y)
def test_render_gan_discriminator():
    fake_shape = (10, 1, 64, 64)
    real_shape = (10, 1, 64, 64)
    fake = Input(batch_shape=fake_shape)
    real = Input(batch_shape=real_shape)
    output = render_gan_discriminator([fake, real])
    model = Model([fake, real], output)
    model.compile('adam', 'mse')
    f = np.random.sample(fake_shape)
    r = np.random.sample(real_shape)
    y = np.random.sample((
        fake_shape[0],
        1,
    ))
    # TODO: fix different batch sizes for input and output
    # y = np.random.sample((fake_shape[0] + real_shape[0], 1,))
    with pytest.raises(ValueError):
        model.train_on_batch([f, r], y)
Beispiel #4
0
 def _build_discriminator(self):
     x = Input(shape=self.data_shape, name='data')
     d = render_gan_discriminator(x, n=self.discriminator_units,
                                  conv_repeat=self.discriminator_depth, dense=[512])
     self.discriminator = Model([x], [d])