class_docstr: Test class for PEARL.
class_docstr_tok: ["Test","class","for","PEARL","."]
docstr: Test pickle and unpickle.
docstr_tok: ["Test","pickle","and","unpickle","."]
code: def test_pickling(self):
      """Test pickle and unpickle."""
      net_size = 10
      env_sampler = SetTaskSampler(PointEnv)
      env = env_sampler.sample(5)
  
      test_env_sampler = SetTaskSampler(PointEnv)
  
      augmented_env = PEARL.augment_env_spec(env[0](), 5)
      qf = ContinuousMLPQFunction(
          env_spec=augmented_env,
          hidden_sizes=[net_size, net_size, net_size],
      )
  
      vf_env = PEARL.get_env_spec(env[0](), 5, "vf")
      vf = ContinuousMLPQFunction(
          env_spec=vf_env, hidden_sizes=[net_size, net_size, net_size]
      )
  
      inner_policy = TanhGaussianMLPPolicy(
          env_spec=augmented_env,
          hidden_sizes=[net_size, net_size, net_size],
      )
  
      pearl = PEARL(
          env=env,
          inner_policy=inner_policy,
          qf=qf,
          vf=vf,
          sampler=None,
          num_train_tasks=5,
          num_test_tasks=5,
          latent_dim=5,
          encoder_hidden_sizes=[10, 10],
          test_env_sampler=test_env_sampler,
      )
  
      # This line is just to improve coverage
      pearl.to()
  
      pickled = pickle.dumps(pearl)
      unpickled = pickle.loads(pickled)
  
      assert hasattr(unpickled, "_replay_buffers")
      assert hasattr(unpickled, "_context_replay_buffers")
      assert unpickled._is_resuming
  
file_path: garage/tests/garage/torch/algos/test_pearl.py
imports: import pickle
  import pytest
  from garage.envs import MetaWorldSetTaskEnv, normalize, PointEnv
  from garage.experiment.deterministic import set_seed
  from garage.experiment.task_sampler import SetTaskSampler
  from garage.sampler import LocalSampler
  from garage.torch import set_gpu_mode
  from garage.torch.algos import PEARL
  from garage.torch.algos.pearl import PEARLWorker
  from garage.torch.embeddings import MLPEncoder
  from garage.torch.policies import ContextConditionedPolicy, TanhGaussianMLPPolicy
  from garage.torch.q_functions import ContinuousMLPQFunction
  from garage.trainer import Trainer
  from tests.fixtures import snapshot_config
  import metaworld
label_desc: Use image node_id 2 for calling the TestPEARL obj's underlying member method code with example usage: obj.test_pickling() without return types