class_docstr: Tests for TanhGaussianMLPPolicy.
class_docstr_tok: ["Tests","for","TanhGaussianMLPPolicy","."]
docstr: Test if policy is unchanged after pickling.
docstr_tok: ["Test","if","policy","is","unchanged","after","pickling","."]
code: def test_is_pickleable(self, batch_size, hidden_sizes):
      """Test if policy is unchanged after pickling."""
      env_spec = GymEnv(DummyBoxEnv())
      obs_dim = env_spec.observation_space.flat_dim
      obs = torch.ones([batch_size, obs_dim], dtype=torch.float32)
      init_std = 2.0
  
      policy = TanhGaussianMLPPolicy(
          env_spec=env_spec,
          hidden_sizes=hidden_sizes,
          init_std=init_std,
          hidden_nonlinearity=None,
          std_parameterization="exp",
          hidden_w_init=nn.init.ones_,
          output_w_init=nn.init.ones_,
      )
  
      output1_action, output1_prob = policy.get_actions(obs)
  
      p = pickle.dumps(policy)
      policy_pickled = pickle.loads(p)
      output2_action, output2_prob = policy_pickled.get_actions(obs)
      assert np.allclose(
          output2_prob["mean"], output1_prob["mean"], rtol=1e-3
      )
      assert output1_action.shape == output2_action.shape
  
file_path: garage/tests/garage/torch/policies/test_tanh_gaussian_mlp_policy.py
imports: import pickle
  import numpy
  import pytest
  import torch
  from torch import nn
  from garage.envs import GymEnv
  from garage.torch.policies import TanhGaussianMLPPolicy
  from tests.fixtures.envs.dummy import DummyBoxEnv, DummyDictEnv
label_desc: Use image node_id 5 for calling the TestTanhGaussianMLPPolicy obj's underlying member method code with example usage: obj.test_is_pickleable(batch_size, hidden_sizes) without return types