You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_logging.py 1.5 kB

4 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import os
  4. import unittest
  5. os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
  6. import tensorflow as tf
  7. import tensorlayer as tl
  8. from tests.utils import CustomTestCase
  9. class TL_Logger_Test(CustomTestCase):
  10. def test_debug(self):
  11. with self.assertNotRaises(Exception):
  12. tl.logging.debug("This is a debug message")
  13. def test_error(self):
  14. with self.assertNotRaises(Exception):
  15. tl.logging.error("This is an error message")
  16. def test_fatal(self):
  17. with self.assertNotRaises(Exception):
  18. tl.logging.fatal("This is a fatal error message")
  19. def test_info(self):
  20. with self.assertNotRaises(Exception):
  21. tl.logging.info("This is an information message")
  22. def test_warn(self):
  23. with self.assertNotRaises(Exception):
  24. tl.logging.warn("This is a warning message")
  25. def test_set_verbosity(self):
  26. with self.assertNotRaises(Exception):
  27. tl.logging.set_verbosity(tl.logging.DEBUG)
  28. tl.logging.set_verbosity(tl.logging.INFO)
  29. tl.logging.set_verbosity(tl.logging.WARN)
  30. tl.logging.set_verbosity(tl.logging.ERROR)
  31. tl.logging.set_verbosity(tl.logging.FATAL)
  32. def test_get_verbosity(self):
  33. with self.assertNotRaises(Exception):
  34. tl.logging.get_verbosity()
  35. if __name__ == '__main__':
  36. tf.logging.set_verbosity(tf.logging.DEBUG)
  37. tl.logging.set_verbosity(tl.logging.DEBUG)
  38. unittest.main()

TensorLayer3.0 是一款兼容多种深度学习框架为计算后端的深度学习库。计划兼容TensorFlow, Pytorch, MindSpore, Paddle.