Skip to content

Commit

Permalink
Set the random seed for reproducibility of the output
Browse files Browse the repository at this point in the history
We also fix the code to use the scripted_cell just created.

Fixes pytorch#1449

Signed-off-by: BJ Hargrave <hargrave@us.ibm.com>
  • Loading branch information
bjhargrave committed Jun 5, 2023
1 parent 121f71a commit 6b1547a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion beginner_source/Intro_to_TorchScript_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import torch # This is all you need to use both PyTorch and TorchScript!
print(torch.__version__)
torch.manual_seed(191009) # set the seed for reproducibility


######################################################################
Expand Down Expand Up @@ -308,7 +309,7 @@ def forward(self, x, h):

# New inputs
x, h = torch.rand(3, 4), torch.rand(3, 4)
traced_cell(x, h)
print(scripted_cell(x, h))


######################################################################
Expand Down

0 comments on commit 6b1547a

Please sign in to comment.