Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

create routine to get testing devices

edgarribaacb746c30c2d
diff --git a/test/common.py b/test/common.py
new file mode 100644
index 000000000..b23225e14
--- /dev/null
+++ b/test/common.py
@@ -0,0 +1,19 @@
+import torch
+
+
+def get_test_devices():
+ """Creates a string list with the devices type to test the source code.
+ CUDA devices will be test only in case the current hardware supports it.
+
+ Return:
+ list(str): list with devices names.
+ """
+ devices = ["cpu"]
+ if torch.cuda.is_available():
+ devices.append("cuda")
+ return devices
+
+
+# setup the devices to test the source code
+
+TEST_DEVICES = get_test_devices()