From 04aff2fbb201d7987957203b9bb7b667f46c4fe9 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Tue, 26 May 2020 16:14:26 +0200 Subject: [PATCH] Added --seed. --- attentiontoy1d.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 -- 2.20.1