Home | History | Annotate | Download | only in deprecated
      1 # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
      4 # you may not use this file except in compliance with the License.
      5 # You may obtain a copy of the License at
      6 #
      7 #     http://www.apache.org/licenses/LICENSE-2.0
      8 #
      9 # Unless required by applicable law or agreed to in writing, software
     10 # distributed under the License is distributed on an "AS IS" BASIS,
     11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
     14 # ==============================================================================
     15 """Tests for the deprecated summary ops in tf.contrib.deprecated."""
     16 
     17 from __future__ import absolute_import
     18 from __future__ import division
     19 from __future__ import print_function
     20 
     21 from tensorflow.python.framework import constant_op
     22 from tensorflow.python.ops import array_ops
     23 from tensorflow.python.ops import logging_ops
     24 from tensorflow.python.platform import test
     25 
     26 
     27 class DeprecatedSummariesTest(test.TestCase):
     28 
     29   def testScalarSummary(self):
     30     with self.cached_session():
     31       c = constant_op.constant(3)
     32       s = logging_ops.scalar_summary('tag', c)
     33       self.assertEqual(s.op.type, u'ScalarSummary')
     34 
     35   def testHistogramSummary(self):
     36     with self.cached_session():
     37       c = constant_op.constant(3)
     38       s = logging_ops.histogram_summary('tag', c)
     39       self.assertEqual(s.op.type, u'HistogramSummary')
     40 
     41   def testImageSummary(self):
     42     with self.cached_session():
     43       i = array_ops.ones((5, 4, 4, 3))
     44       s = logging_ops.image_summary('tag', i)
     45       self.assertEqual(s.op.type, u'ImageSummary')
     46 
     47   def testAudioSummary(self):
     48     with self.cached_session():
     49       c = constant_op.constant(3.0)
     50       s = logging_ops.audio_summary('tag', c, sample_rate=8000)
     51       self.assertEqual(s.op.type, u'AudioSummaryV2')
     52 
     53   def testMergeSummary(self):
     54     with self.cached_session():
     55       c = constant_op.constant(3)
     56       a = logging_ops.scalar_summary('a', c)
     57       b = logging_ops.scalar_summary('b', c)
     58       s = logging_ops.merge_summary([a, b])
     59       self.assertEqual(s.op.type, u'MergeSummary')
     60 
     61 
     62 if __name__ == '__main__':
     63   test.main()
     64