Skip to content

Commit c14233d

Browse files
pytorchbotatalman
andauthored
Make numpy check optional (pytorch#153421)
Make numpy check optional (pytorch#149356) We may want to skip numpy smoke tests. Hence making it optional Pull Request resolved: pytorch#149356 Approved by: https://github.com/ZainRizvi (cherry picked from commit 6e2b266) Co-authored-by: atalman <[email protected]>
1 parent 3bfe071 commit c14233d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.ci/pytorch/smoke_test/smoke_test.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,13 @@ def read_release_matrix():
7676

7777

7878
def test_numpy():
79-
import numpy as np
79+
try:
80+
import numpy as np
8081

81-
x = np.arange(5)
82-
torch.tensor(x)
82+
x = np.arange(5)
83+
torch.tensor(x)
84+
except ImportError:
85+
print("Numpy check skipped. Numpy is not installed.")
8386

8487

8588
def check_version(package: str) -> None:
@@ -410,6 +413,7 @@ def main() -> None:
410413
smoke_test_conv2d()
411414
test_linalg()
412415
test_numpy()
416+
413417
if is_cuda_system:
414418
test_linalg("cuda")
415419
test_cuda_gds_errors_captured()

0 commit comments

Comments
 (0)