class_docstr: Base class for continual learning skeletons.
  
  **Training loop**
  The training loop is organized as follows::
  
      train
          train_exp  # for each experience
  
  **Evaluation loop**
  The evaluation loop is organized as follows::
  
      eval
          eval_exp  # for each experience
class_docstr_tok: ["Base","class","for","continual","learning","skeletons",".","*","*","Training","loop","*","*","The","training","loop","is","organized","as","follows",":",":","train","train_exp","#","for","each","experience","*","*","Evaluation","loop","*","*","The","evaluation","loop","is","organized","as","follows",":",":","eval","eval_exp","#","for","each","experience"]
code: def _load_train_state(self, prev_state):
      # restore train-state variables and training mode.
      self.experience = prev_state["experience"]
      self.is_training = prev_state["is_training"]
  
      # restore each layer's training mode to original
      prev_training_modes = prev_state["model_training_mode"]
      for name, layer in self.model.named_modules():
          try:
              prev_mode = prev_training_modes[name]
              layer.train(mode=prev_mode)
          except KeyError:
              # Unknown parameter, probably added during the eval
              # model's adaptation. We set it to train mode.
              layer.train()
  
imports: import sys
  import warnings
  from collections import defaultdict
  from typing import Iterable, Sequence, Optional, TypeVar, Union, List
  import torch
  from torch.nn import Module
  from avalanche.benchmarks import CLExperience, CLStream
  from avalanche.core import BasePlugin
  from avalanche.distributed.distributed_helper import DistributedHelper
  from avalanche.training.templates.strategy_mixin_protocol import BaseStrategyProtocol
  from avalanche.training.utils import trigger_plugins
label_desc: Use image node_id 10 for calling the BaseTemplate obj's underlying member method code with example usage: obj._load_train_state(prev_state) without return types