From: Francois Fleuret Date: Tue, 26 May 2020 14:14:26 +0000 (+0200) Subject: Added --seed. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=04aff2fbb201d7987957203b9bb7b667f46c4fe9;p=pytorch.git Added --seed. --- diff --git a/attentiontoy1d.py b/attentiontoy1d.py index d7f06fe..92d90cf 100755 --- a/attentiontoy1d.py +++ b/attentiontoy1d.py @@ -31,8 +31,15 @@ parser.add_argument('--positional_encoding', help = 'Provide a positional encoding', action='store_true', default=False) +parser.add_argument('--seed', + type = int, default = 0, + help = 'Random seed (default 0, < 0 is no seeding)') + args = parser.parse_args() +if args.seed >= 0: + torch.manual_seed(args.seed) + ###################################################################### label='' @@ -62,8 +69,6 @@ if torch.cuda.is_available(): else: device = torch.device('cpu') -torch.manual_seed(1) - ###################################################################### seq_height_min, seq_height_max = 1.0, 25.0