Unverified Commit 5ade35f4 authored by Wenwei Zhang's avatar Wenwei Zhang Committed by GitHub
Browse files

use elif rather than if (#491)

parent 4cc48073
...@@ -9,6 +9,6 @@ class DistSamplerSeedHook(Hook): ...@@ -9,6 +9,6 @@ class DistSamplerSeedHook(Hook):
if hasattr(runner.data_loader.sampler, 'set_epoch'): if hasattr(runner.data_loader.sampler, 'set_epoch'):
# in case the data loader uses `SequentialSampler` in Pytorch # in case the data loader uses `SequentialSampler` in Pytorch
runner.data_loader.sampler.set_epoch(runner.epoch) runner.data_loader.sampler.set_epoch(runner.epoch)
if hasattr(runner.data_loader.batch_sampler.sampler, 'set_epoch'): elif hasattr(runner.data_loader.batch_sampler.sampler, 'set_epoch'):
# batch sampler in pytorch warps a sampler as its attributes. # batch sampler in pytorch warps the sampler as its attributes.
runner.data_loader.batch_sampler.sampler.set_epoch(runner.epoch) runner.data_loader.batch_sampler.sampler.set_epoch(runner.epoch)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment