Skip to content

Commit 78df97b

Browse files
authored
Make DCGan tutorial results reproducible
By using deterministic algorithm That should prevent repo size increase by 70Mb after every commit, but will make tutorial slightly slower (though not significantly) Also, remove unused/absolete imports
1 parent 3a58c51 commit 78df97b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

beginner_source/dcgan_faces_tutorial.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,13 @@
112112
# will be explained in the coming sections.
113113
#
114114

115-
from __future__ import print_function
116115
#%matplotlib inline
117116
import argparse
118117
import os
119118
import random
120119
import torch
121120
import torch.nn as nn
122121
import torch.nn.parallel
123-
import torch.backends.cudnn as cudnn
124122
import torch.optim as optim
125123
import torch.utils.data
126124
import torchvision.datasets as dset
@@ -137,6 +135,7 @@
137135
print("Random Seed: ", manualSeed)
138136
random.seed(manualSeed)
139137
torch.manual_seed(manualSeed)
138+
torch.use_deterministic_algorithms(True) # Needed for reproducible results
140139

141140

142141
######################################################################

0 commit comments

Comments
 (0)