Ejemplo n.º 1
0
 def testComputeConvOutputPadding(self, padding, expected_padding, stride,
                                  padding_algorithm):
   """Tests padding behavior. There are multiple bugs in the implementation."""
   padding = tf.constant([padding], tf.float32)
   expected_padding = tf.constant([expected_padding], tf.float32)
   with self.session(use_gpu=True):
     conv_padding = conv_layers.ComputeConvOutputPadding(
         padding, window=3, stride=stride, padding_algorithm=padding_algorithm)
     self.evaluate(tf.global_variables_initializer())
     conv_padding = py_utils.Debug(conv_padding)
     conv_padding = self.evaluate(conv_padding)
     tf.logging.info('expected_padding {expected_padding}')
     self.assertAllClose(expected_padding, conv_padding)
 def testComputeConvOutputPadding(self, padding, expected_padding, stride,
                                  padding_algorithm):
     """Test Convolution padding computation."""
     padding = tf.constant([padding], tf.float32)
     expected_padding = tf.constant([expected_padding], tf.float32)
     with self.session(use_gpu=True) as sess:
         conv_padding = conv_layers.ComputeConvOutputPadding(
             padding,
             window=3,
             stride=stride,
             padding_algorithm=padding_algorithm)
         tf.global_variables_initializer().run()
         conv_padding = py_utils.Debug(conv_padding)
         conv_padding = sess.run(conv_padding)
         tf.logging.info('expected_padding {expected_padding}')
         self.assertAllClose(expected_padding, conv_padding)