def compute_and_check_summary_pb(self,
                                     name,
                                     images,
                                     max_outputs=3,
                                     images_tensor=None,
                                     feed_dict=None):
        """Use both `op` and `pb` to get a summary, asserting equality.

    Returns:
      a `Summary` protocol buffer
    """
        if images_tensor is None:
            images_tensor = tf.cast(tf.constant(images), tf.uint8)
        op = summary.op(name, images_tensor, max_outputs=max_outputs)
        pb = summary.pb(name, images, max_outputs=max_outputs)
        pb_via_op = self.pb_via_op(op, feed_dict=feed_dict)
        self.assertProtoEquals(pb, pb_via_op)
        return pb
Example #2
0
 def image(self, *args, **kwargs):
   return summary.pb(*args, **kwargs)
 def test_requires_rank_4_in_pb(self):
     with six.assertRaisesRegex(self, ValueError, 'must have rank 4'):
         summary.pb('mona_lisa', np.array([[1, 2, 3], [4, 5, 6]]))