Skip to content

Commit 89275af

Browse files
NicolasHugfacebook-github-bot
authored andcommitted
[fbsync] Execute compile smoke test only on linux, check that windows throws an exception (#7386)
Reviewed By: vmoens Differential Revision: D44416627 fbshipit-source-id: 1c80b39b36b3a100be881c624ef90aa6d471d4b4
1 parent f2122e8 commit 89275af

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

test/smoke_test.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import os
44
from pathlib import Path
5+
from sys import platform
56

67
import torch
78
import torch.nn as nn
@@ -29,11 +30,17 @@ def smoke_test_torchvision_read_decode() -> None:
2930

3031

3132
def smoke_test_compile() -> None:
32-
model = resnet50().cuda()
33-
model = torch.compile(model)
34-
x = torch.randn(1, 3, 224, 224, device="cuda")
35-
out = model(x)
36-
print(f"torch.compile model output: {out.shape}")
33+
try:
34+
model = resnet50().cuda()
35+
model = torch.compile(model)
36+
x = torch.randn(1, 3, 224, 224, device="cuda")
37+
out = model(x)
38+
print(f"torch.compile model output: {out.shape}")
39+
except RuntimeError:
40+
if platform == "win32":
41+
print("Successfully caught torch.compile RuntimeError on win")
42+
else:
43+
raise
3744

3845

3946
def smoke_test_torchvision_resnet50_classify(device: str = "cpu") -> None:

0 commit comments

Comments
 (0)