Esempio n. 1
0
 def test_non_string_value_in_op(self):
   with six.assertRaisesRegex(
       self,
       Exception,
       r'Const:0 must be of type <dtype: \'string\'>'):
     with tf.Session() as sess:
       sess.run(summary.op('so', tf.constant(5)))
Esempio n. 2
0
  def compute_and_check_summary_pb(self, name, data,
                                   display_name=None, description=None,
                                   data_tensor=None, feed_dict=None):
    """Use both `op` and `pb` to get a summary, asserting equality.

    Returns:
      a `Summary` protocol buffer
    """
    if data_tensor is None:
      data_tensor = tf.constant(data)
    op = summary.op(
        name, data, display_name=display_name, description=description)
    pb = self.normalize_summary_pb(summary.pb(
        name, data, display_name=display_name, description=description))
    pb_via_op = self.normalize_summary_pb(
        self.pb_via_op(op, feed_dict=feed_dict))
    self.assertProtoEquals(pb, pb_via_op)
    return pb
Esempio n. 3
0
 def text(self, *args, **kwargs):
     return tf.Summary.FromString(summary.op(*args, **kwargs).numpy())
Esempio n. 4
0
 def test_non_string_value_in_op(self):
     with six.assertRaisesRegex(self, Exception,
                                r'must be of type <dtype: \'string\'>'):
         with tf.Session() as sess:
             sess.run(summary.op('so', tf.constant(5)))