class_docstr: Tests for TanhGaussianMLPPolicy.
class_docstr_tok: ["Tests","for","TanhGaussianMLPPolicy","."]
docstr: Test Tanh Gaussian Policy can be moved to cpu.
docstr_tok: ["Test","Tanh","Gaussian","Policy","can","be","moved","to","cpu","."]
code: def test_to(self):
      """Test Tanh Gaussian Policy can be moved to cpu."""
      env_spec = GymEnv(DummyBoxEnv())
      init_std = 2.0
  
      policy = TanhGaussianMLPPolicy(
          env_spec=env_spec,
          hidden_sizes=(1,),
          init_std=init_std,
          hidden_nonlinearity=None,
          std_parameterization="exp",
          hidden_w_init=nn.init.ones_,
          output_w_init=nn.init.ones_,
      )
      if torch.cuda.is_available():
          policy.to(torch.device("cuda:0"))
          assert str(next(policy.parameters()).device) == "cuda:0"
      else:
          policy.to(None)
          assert str(next(policy.parameters()).device) == "cpu"
  
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 6 for calling the TestTanhGaussianMLPPolicy obj's underlying member method code with example usage: obj.test_to() without return types