Stylique commited on
Commit
230724b
Β·
verified Β·
1 Parent(s): c625198

Upload 2 files

Browse files
Files changed (1) hide show
  1. test_installation.py +61 -61
test_installation.py CHANGED
@@ -21,35 +21,35 @@ def test_imports():
21
  print(f"βœ— PyTorch import failed: {e}")
22
  return False
23
 
24
- # Check if torch-sparse is available or disabled
25
- try:
26
- import torch_sparse
27
- print("βœ“ torch-sparse")
28
- except ImportError:
29
- # Check if torch-sparse was disabled
30
- try:
31
- with open("NeuralJacobianFields/PoissonSystem.py", 'r') as f:
32
- content = f.read()
33
- if "USE_TORCH_SPARSE = False" in content:
34
- print("βœ“ torch-sparse (disabled, using built-in PyTorch sparse)")
35
- else:
36
- print("βœ— torch-sparse (not available)")
37
- return False
38
- except:
39
- print("βœ— torch-sparse (not available)")
40
- return False
41
- except Exception as e:
42
- print(f"βœ— torch-sparse import failed: {e}")
43
- return False
44
 
45
- # Check if torch-scatter is available (not critical)
46
- try:
47
- import torch_scatter
48
- print("βœ“ torch-scatter")
49
- except ImportError:
50
- print("⚠ torch-scatter (not available, may not be critical)")
51
- except Exception as e:
52
- print(f"⚠ torch-scatter import failed: {e} (may not be critical)")
53
 
54
  try:
55
  import nvdiffrast
@@ -78,39 +78,39 @@ def test_basic_functionality():
78
  """Test basic functionality of key components"""
79
  print("\nTesting basic functionality...")
80
 
81
- try:
82
- import torch
83
-
84
- # Test basic tensor operations
85
- x = torch.randn(10, 10)
86
- y = torch.randn(10, 10)
87
- z = x + y
88
- print("βœ“ Basic tensor operations")
89
-
90
- # Test sparse operations (using built-in PyTorch sparse)
91
- indices = torch.randint(0, 10, (2, 20))
92
- values = torch.randn(20)
93
- sparse_tensor = torch.sparse_coo_tensor(indices, values, (10, 10))
94
- print("βœ“ Sparse tensor creation")
95
-
96
- # Test if torch-sparse is available (optional)
97
- try:
98
- import torch_sparse
99
- print("βœ“ torch-sparse operations available")
100
- except ImportError:
101
- print("βœ“ Using built-in PyTorch sparse operations")
102
-
103
- # Test if torch-scatter is available (optional)
104
- try:
105
- import torch_scatter
106
- print("βœ“ torch-scatter operations available")
107
- except ImportError:
108
- print("βœ“ torch-scatter not available (not critical)")
109
-
110
- except Exception as e:
111
- print(f"βœ— Basic functionality test failed: {e}")
112
- traceback.print_exc()
113
- return False
114
 
115
  return True
116
 
 
21
  print(f"βœ— PyTorch import failed: {e}")
22
  return False
23
 
24
+ # Check if torch-sparse is available or disabled
25
+ try:
26
+ import torch_sparse
27
+ print("βœ“ torch-sparse")
28
+ except ImportError:
29
+ # Check if torch-sparse was disabled
30
+ try:
31
+ with open("NeuralJacobianFields/PoissonSystem.py", 'r') as f:
32
+ content = f.read()
33
+ if "USE_TORCH_SPARSE = False" in content:
34
+ print("βœ“ torch-sparse (disabled, using built-in PyTorch sparse)")
35
+ else:
36
+ print("βœ— torch-sparse (not available)")
37
+ return False
38
+ except:
39
+ print("βœ— torch-sparse (not available)")
40
+ return False
41
+ except Exception as e:
42
+ print(f"βœ— torch-sparse import failed: {e}")
43
+ return False
44
 
45
+ # Check if torch-scatter is available (not critical)
46
+ try:
47
+ import torch_scatter
48
+ print("βœ“ torch-scatter")
49
+ except ImportError:
50
+ print("⚠ torch-scatter (not available, may not be critical)")
51
+ except Exception as e:
52
+ print(f"⚠ torch-scatter import failed: {e} (may not be critical)")
53
 
54
  try:
55
  import nvdiffrast
 
78
  """Test basic functionality of key components"""
79
  print("\nTesting basic functionality...")
80
 
81
+ try:
82
+ import torch
83
+
84
+ # Test basic tensor operations
85
+ x = torch.randn(10, 10)
86
+ y = torch.randn(10, 10)
87
+ z = x + y
88
+ print("βœ“ Basic tensor operations")
89
+
90
+ # Test sparse operations (using built-in PyTorch sparse)
91
+ indices = torch.randint(0, 10, (2, 20))
92
+ values = torch.randn(20)
93
+ sparse_tensor = torch.sparse_coo_tensor(indices, values, (10, 10))
94
+ print("βœ“ Sparse tensor creation")
95
+
96
+ # Test if torch-sparse is available (optional)
97
+ try:
98
+ import torch_sparse
99
+ print("βœ“ torch-sparse operations available")
100
+ except ImportError:
101
+ print("βœ“ Using built-in PyTorch sparse operations")
102
+
103
+ # Test if torch-scatter is available (optional)
104
+ try:
105
+ import torch_scatter
106
+ print("βœ“ torch-scatter operations available")
107
+ except ImportError:
108
+ print("βœ“ torch-scatter not available (not critical)")
109
+
110
+ except Exception as e:
111
+ print(f"βœ— Basic functionality test failed: {e}")
112
+ traceback.print_exc()
113
+ return False
114
 
115
  return True
116