Return the state of the scheduler as a dictionary.
(self)
| 857 | return self._last_lr |
| 858 | |
| 859 | def state_dict(self) -> dict[str, Any]: |
| 860 | """Return the state of the scheduler as a dictionary.""" |
| 861 | state = { |
| 862 | "factor": self.factor, |
| 863 | "min_lrs": self.min_lrs, |
| 864 | "max_lrs": self.max_lrs, |
| 865 | "patience": self.patience, |
| 866 | "verbose": self.verbose, |
| 867 | "cooldown": self.cooldown, |
| 868 | "warmup": self.warmup, |
| 869 | "cooldown_counter": self.cooldown_counter, |
| 870 | "warmup_counter": self.warmup_counter, |
| 871 | "mode": self.mode, |
| 872 | "threshold": self.threshold, |
| 873 | "threshold_mode": self.threshold_mode, |
| 874 | "best": self.best, |
| 875 | "num_bad_epochs": self.num_bad_epochs, |
| 876 | "num_good_epochs": self.num_good_epochs, |
| 877 | "eps": self.eps, |
| 878 | "last_epoch": self.last_epoch, |
| 879 | "smooth": self.smooth, |
| 880 | "window_size": self.window_size, |
| 881 | "reset_start": self.reset_start, |
| 882 | "reset_start_original": self.reset_start_original, |
| 883 | "_last_lr": self._last_lr, |
| 884 | "_init_lrs": self._init_lrs, |
| 885 | } |
| 886 | |
| 887 | if self.smooth and self._streaming_avg is not None: |
| 888 | state["_streaming_avg"] = self._streaming_avg.state_dict() |
| 889 | |
| 890 | return state |
| 891 | |
| 892 | def load_state_dict(self, state_dict: dict[str, Any]) -> None: |
| 893 | """Load state from a dictionary.""" |
no outgoing calls
no test coverage detected