class_docstr: This class implements a regressor with the PyTorch framework.
class_docstr_tok: ["This","class","implements","a","regressor","with","the","PyTorch","framework","."]
docstr: Use to ensure `PyTorchRegressor` can be unpickled.
  
  :param state: State dictionary with instance parameters to restore.
docstr_tok: ["Use","to","ensure","`","PyTorchRegressor","`","can","be","unpickled",".",":","param","state",":","State","dictionary","with","instance","parameters","to","restore","."]
code: def __setstate__(self, state: Dict[str, Any]) -> None:
      """
      Use to ensure `PyTorchRegressor` can be unpickled.
  
      :param state: State dictionary with instance parameters to restore.
      """
      import torch
  
      # Recover model
      self.__dict__.update(state)
      full_path = os.path.join(
          config.ART_DATA_PATH, state["model_name"]
      )
      model = state["inner_model"]
      model.load_state_dict(torch.load(str(full_path) + ".model"))
      model.eval()
      self._model = self._make_model_wrapper(model)
  
      # Recover device
      self._device = torch.device(
          "cuda:0" if torch.cuda.is_available() else "cpu"
      )
      self._model.to(self._device)
  
      # Recover optimizer
      self._optimizer.load_state_dict(torch.load(str(full_path) + ".optimizer"))  # type: ignore
  
      self.__dict__.pop("model_name", None)
      self.__dict__.pop("inner_model", None)
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import copy
  import logging
  import os
  import time
  from typing import Any, Dict, List, Optional, Tuple, Union, TYPE_CHECKING
  import numpy
  import six
  from art import config
  from art.estimators.regression.regressor import RegressorMixin
  from art.estimators.pytorch import PyTorchEstimator
label_desc: Use image node_id 24 for calling the PyTorchRegressor obj's underlying member method code with example usage: obj.__setstate__(state) without return types