Exemplo n.º 1
0
 def testPostProcessImageTrainMode(self, likelihood, num_mixtures, depth):
   batch = 1
   rows = 8
   cols = 24
   hparams = hparam.HParams(
       hidden_size=2,
       likelihood=likelihood,
       mode=tf.estimator.ModeKeys.TRAIN,
       num_mixtures=num_mixtures,
   )
   inputs = tf.random_uniform([batch, rows, cols, hparams.hidden_size],
                              minval=-1., maxval=1.)
   outputs = common_image_attention.postprocess_image(
       inputs, rows, cols, hparams)
   self.assertEqual(outputs.shape, (batch, rows, cols, depth))
 def testPostProcessImageTrainMode(self, likelihood, num_mixtures, depth):
   batch = 1
   rows = 8
   cols = 24
   hparams = tf.contrib.training.HParams(
       hidden_size=2,
       likelihood=likelihood,
       mode=tf.estimator.ModeKeys.TRAIN,
       num_mixtures=num_mixtures,
   )
   inputs = tf.random_uniform([batch, rows, cols, hparams.hidden_size],
                              minval=-1., maxval=1.)
   outputs = common_image_attention.postprocess_image(
       inputs, rows, cols, hparams)
   self.assertEqual(outputs.shape, (batch, rows, cols, depth))
Exemplo n.º 3
0
 def testPostProcessImageInferMode(self, likelihood, num_mixtures, depth):
   batch = 1
   rows = 8
   cols = 24
   block_length = 4
   block_width = 2
   hparams = hparam.HParams(
       block_raster_scan=True,
       hidden_size=2,
       likelihood=likelihood,
       mode=tf.estimator.ModeKeys.PREDICT,
       num_mixtures=num_mixtures,
       query_shape=[block_length, block_width],
   )
   inputs = tf.random_uniform([batch, rows, cols, hparams.hidden_size],
                              minval=-1., maxval=1.)
   outputs = common_image_attention.postprocess_image(
       inputs, rows, cols, hparams)
   num_blocks_rows = rows // block_length
   num_blocks_cols = cols // block_width
   self.assertEqual(outputs.shape,
                    (batch, num_blocks_rows, num_blocks_cols,
                     block_length, block_width, depth))
 def testPostProcessImageInferMode(self, likelihood, num_mixtures, depth):
   batch = 1
   rows = 8
   cols = 24
   block_length = 4
   block_width = 2
   hparams = tf.contrib.training.HParams(
       block_raster_scan=True,
       hidden_size=2,
       likelihood=likelihood,
       mode=tf.contrib.learn.ModeKeys.INFER,
       num_mixtures=num_mixtures,
       query_shape=[block_length, block_width],
   )
   inputs = tf.random_uniform([batch, rows, cols, hparams.hidden_size],
                              minval=-1., maxval=1.)
   outputs = common_image_attention.postprocess_image(
       inputs, rows, cols, hparams)
   num_blocks_rows = rows // block_length
   num_blocks_cols = cols // block_width
   self.assertEqual(outputs.shape,
                    (batch, num_blocks_rows, num_blocks_cols,
                     block_length, block_width, depth))