Skip to content

Commit 7cbfc9c

Browse files
author
Thiago Crepaldi
committed
Fix tutorial when cudnn is not available
1 parent a3ce3e7 commit 7cbfc9c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

intermediate_source/memory_format_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
# produces output in contiguous memory format. Otherwise, output will
132132
# be in channels last memory format.
133133

134-
if torch.backends.cudnn.version() >= 7603:
134+
if torch.backends.cudnn.is_available() and torch.backends.cudnn.version() >= 7603:
135135
model = torch.nn.Conv2d(8, 4, 3).cuda().half()
136136
model = model.to(memory_format=torch.channels_last) # Module parameters need to be channels last
137137

0 commit comments

Comments
 (0)