Beispiel #1
0
 def __call__(self, x):
     """Discriminate images.
     """
     with nn.parameter_scope("discriminator"):
         h = self.from_RGB(x, self.resolution_list[-1],
                           self.channel_list[-1])
         for i in range(1, len(self.resolution_list))[::-1]:
             h = self.cnn(h, self.resolution_list[i], self.channel_list[i],
                          self.channel_list[i - 1])
         h = minibatch_stddev(h)
         h = self.last_cnn(h, self.resolution_list[0],
                           self.resolution_list[0], self.resolution_list[0])
     return h
Beispiel #2
0
    def transition(self, x, alpha):
        """Generator in the transition period, almost the same as the callable.

        """
        with nn.parameter_scope("discriminator"):
            h = self.transition_cnn(x, self.resolution_list[-2], self.resolution_list[-1],
                                    self.channel_list[-2], self.channel_list[-1], alpha)
            for i in range(1, len(self.resolution_list) - 1)[::-1]:
                h = self.cnn(h, self.resolution_list[i], self.channel_list[i],
                             self.channel_list[i - 1])
            h = minibatch_stddev(h)
            h = self.last_cnn(h, self.resolution_list[0], self.resolution_list[0],
                              self.resolution_list[0])
        return h