class_docstr: The old BaseStrategy (avalanche 0.1.0)
  just a bit of refactoring to remove useless components for testing.
class_docstr_tok: ["The","old","BaseStrategy","(","avalanche","0.1.0",")","just","a","bit","of","refactoring","to","remove","useless","components","for","testing","."]
docstr: Save the training state which may be modified by the eval loop.
  
  This currently includes: experience, adapted_dataset, dataloader,
  is_training, and train/eval modes for each module.
  
  TODO: we probably need a better way to do this.
docstr_tok: ["Save","the","training","state","which","may","be","modified","by","the","eval","loop",".","This","currently","includes",":","experience",",","adapted_dataset",",","dataloader",",","is_training",",","and","train\/eval","modes","for","each","module",".","TODO",":","we","probably","need","a","better","way","to","do","this","."]
code: def _save_train_state(self):
      """Save the training state which may be modified by the eval loop.
  
      This currently includes: experience, adapted_dataset, dataloader,
      is_training, and train/eval modes for each module.
  
      TODO: we probably need a better way to do this.
      """
      _prev_state = (
          self.experience,
          self.adapted_dataset,
          self.dataloader,
          self.is_training,
      )
      # save each layer's training mode, to restore it later
      _prev_model_training_modes = {}
      for name, layer in self.model.named_modules():
          _prev_model_training_modes[name] = layer.training
      return _prev_model_training_modes, _prev_state
  
imports: import copy
  import logging
  import unittest
  import numpy
  import torch
  from torch.utils.data import DataLoader
  from typing import Optional, Sequence, Union
  from torch.nn import Module, CrossEntropyLoss
  from torch.optim import SGD
  from avalanche.benchmarks.scenarios import ClassificationExperience
  from avalanche.benchmarks.utils.data_loader import TaskBalancedDataLoader
  from avalanche.models import DynamicModule, SimpleMLP, MTSimpleMLP
  from avalanche.models.dynamic_optimizers import reset_optimizer
  from avalanche.models.utils import avalanche_forward
  from avalanche.training import Cumulative
  from avalanche.training.plugins.clock import Clock
  from avalanche.training.plugins import EvaluationPlugin
  from avalanche.training.templates import SupervisedTemplate
  from avalanche.training.utils import trigger_plugins
  from tests.unit_tests_utils import get_fast_benchmark
label_desc: Use image node_id 10 for calling the OldBaseStrategy obj's underlying member method code with example usage: obj._save_train_state() and returns: _prev_model_training_modes,  _prev_state