'Tests that the output of the graph of the given spec has target_shape.'

def ExpectScaledSize(self, spec, target_shape, factor=1):

    with tf.Graph().as_default():
        with self.test_session() as sess:
            self.SetupInputs()
            vgsl = vgslspecs.VGSLSpecs(self.ph_widths, self.ph_heights, True)
            outputs = vgsl.Build(self.ph_image, spec)
            target_widths = tf.div(self.in_widths, factor).eval()
            target_heights = tf.div(self.in_heights, factor).eval()
            tf.global_variables_initializer().run()
            (res_image, res_widths, res_heights) = sess.run([outputs, vgsl.GetLengths(2), vgsl.GetLengths(1)], feed_dict={self.ph_image: self.in_image, self.ph_widths: self.in_widths, self.ph_heights: self.in_heights})
            self.assertEqual(tuple(res_image.shape), target_shape)
            if (target_shape[1] > 1):
                self.assertEqual(tuple(res_heights), tuple(target_heights))
            if (target_shape[2] > 1):
                self.assertEqual(tuple(res_widths), tuple(target_widths))
