Esempio n. 1
0
    def test_too_small_size(self):
        """
        Tests that building a discriminator with too small of a size raises a
        DiscriminatorSizeError
        """
        for size in range(0, 8):
            with self.assertRaises(DiscriminatorSizeError):
                Discriminator.build_model(in_size=size, in_channels=3)

            with self.assertRaises(DiscriminatorSizeError):
                Discriminator.build_model(in_size=size, in_channels=1)
Esempio n. 2
0
 def _make_discriminator_get_output_shapes(in_size: int,
                                           in_channels: int) -> list:
     """
     Makes a discriminator and returns a list of its layers' output shapes
     :param in_size: input size
     :param in_channels: input channels
     :return: a list of tuples for each layer's output shape
     """
     return [layer.output_shape for layer in
             Discriminator.build_model(in_size=in_size,
                                       in_channels=in_channels).layers]
Esempio n. 3
0
 def _make_discriminator(self) -> K.Model:
     """
     :return: Make a discriminator model for this instance
     """
     return Discriminator.build_model(in_size=self._size,
                                      in_channels=self._channels)