Skip to content

Commit

Permalink
Add seed to dict only if transformed Subject
Browse files Browse the repository at this point in the history
  • Loading branch information
fepegar committed Jul 11, 2020
1 parent 65f9e99 commit 7fbd4af
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion torchio/transforms/augmentation/random_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ def __call__(self, sample: Subject):
with torch.random.fork_rng():
self.check_seed()
transformed = super().__call__(sample)
random_params_dict = transformed.history[-1][1]
if transformed is sample:
pass # the transform was not applied
elif not isinstance(transformed, Subject):
pass # random parameters are stored in instances of Subject
else:
_, random_params_dict = transformed.history[-1]
random_params_dict['seed'] = self._seed
return transformed

Expand Down

0 comments on commit 7fbd4af

Please sign in to comment.