Skip to content

Commit

Permalink
import math in sampler.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ramanishsingh committed Aug 21, 2024
1 parent 306431e commit fe08bfc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions torchdata/stateful_dataloader/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

import math
from typing import Any, Dict, Iterator, Optional, Sized

import torch.utils.data.sampler
Expand Down Expand Up @@ -40,6 +41,7 @@ def load_state_dict(self, state_dict: Dict[str, Any]) -> None:
self.generator_state = state_dict[self._GENERATOR]
self.sampler.generator.set_state(state_dict[self._GENERATOR])
self.next_yielded = state_dict[self._YIELDED]
return None

def state_dict(self) -> Dict[str, Any]:
return {self._GENERATOR: self.generator_state, self._YIELDED: self.yielded}
Expand Down

0 comments on commit fe08bfc

Please sign in to comment.