test_loading.py 642 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. __author__ = "Christian Heider Nielsen"
  4. __doc__ = r"""
  5. Created on 08-12-2020
  6. """
  7. from draugr.torch_utilities import global_pin_memory
  8. def test_load_pin_memory_global():
  9. print(global_pin_memory(0))
  10. print(global_pin_memory(1))
  11. print(global_pin_memory(2))
  12. print()
  13. print(global_pin_memory(0, "cpu"))
  14. print(global_pin_memory(1, "cpu"))
  15. print(global_pin_memory(1, "cuda"))
  16. print()
  17. print(print(global_pin_memory(0, "cuda:0")))
  18. print(print(global_pin_memory(1, "cuda:0")))
  19. if __name__ == "__main__":
  20. test_load_pin_memory_global()