Пример #1
0
  def _input_and_output_same_shape_helper(self, kernel_size):
    img_batch = tf.placeholder(tf.float32, shape=[None, 32, 32, 3])
    output_img_batch, _ = cyclegan.cyclegan_generator_resnet(
        img_batch, kernel_size=kernel_size)

    self.assertAllEqual(img_batch.shape.as_list(),
                        output_img_batch.shape.as_list())
Пример #2
0
 def test_generator_inference(self):
   """Check one inference step."""
   img_batch = tf.zeros([2, 32, 32, 3])
   model_output, _ = cyclegan.cyclegan_generator_resnet(img_batch)
   with self.test_session() as sess:
     sess.run(tf.global_variables_initializer())
     sess.run(model_output)
Пример #3
0
 def test_generator_inference(self):
     """Check one inference step."""
     img_batch = tf.zeros([2, 32, 32, 3])
     model_output, _ = cyclegan.cyclegan_generator_resnet(img_batch)
     with self.test_session() as sess:
         sess.run(tf.global_variables_initializer())
         sess.run(model_output)
Пример #4
0
    def _input_and_output_same_shape_helper(self, kernel_size):
        img_batch = tf.placeholder(tf.float32, shape=[None, 32, 32, 3])
        output_img_batch, _ = cyclegan.cyclegan_generator_resnet(
            img_batch, kernel_size=kernel_size)

        self.assertAllEqual(img_batch.shape.as_list(),
                            output_img_batch.shape.as_list())
Пример #5
0
    def test_generator_unknown_batch_dim(self):
        """Check that generator can take unknown batch dimension inputs."""
        img = tf.placeholder(tf.float32, shape=[None, 32, None, 3])
        output_imgs, _ = cyclegan.cyclegan_generator_resnet(img)

        self.assertAllEqual([None, 32, None, 3], output_imgs.shape.as_list())
Пример #6
0
 def _test_generator_graph_helper(self, shape):
     """Check that generator can take small and non-square inputs."""
     output_imgs, _ = cyclegan.cyclegan_generator_resnet(tf.ones(shape))
     self.assertAllEqual(shape, output_imgs.shape.as_list())
Пример #7
0
  def test_generator_unknown_batch_dim(self):
    """Check that generator can take unknown batch dimension inputs."""
    img = tf.placeholder(tf.float32, shape=[None, 32, None, 3])
    output_imgs, _ = cyclegan.cyclegan_generator_resnet(img)

    self.assertAllEqual([None, 32, None, 3], output_imgs.shape.as_list())
Пример #8
0
 def _test_generator_graph_helper(self, shape):
   """Check that generator can take small and non-square inputs."""
   output_imgs, _ = cyclegan.cyclegan_generator_resnet(tf.ones(shape))
   self.assertAllEqual(shape, output_imgs.shape.as_list())