code: def default_policy_fn(
      env: TuningEnvironment, lr: float = 1.0e-4, hidden_dim: int = 64
  ) -> PPOPolicy:
      """Create a default policy for the given environment.
  
      The default policy is a PPO policy, with a simple LSTM + MLP network.
  
      To customize the parameters of this function, use::
  
          from functools import partial
          partial(default_policy_fn, lr=1.0e-3, hidden_dim=128)
  
      Parameters
      ----------
      lr
          Learning rate for the Adam optimizer.
      hidden_dim
          Hidden dimension of the LSTM and MLP.
      """
      net = Preprocessor(env.observation_space, hidden_dim)
      actor = Actor(env.action_space, net)
      critic = Critic(net)
      optim = torch.optim.Adam(
          set(actor.parameters()).union(critic.parameters()), lr=lr
      )
      return PPOPolicy(
          actor,
          critic,
          optim,
          torch.distributions.Categorical,
          discount_factor=1.0,
          action_space=env.action_space,
      )
  
imports: from __future__ import annotations
  from copy import deepcopy
  from typing import Tuple, Callable
  import gym
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from typing_extensions import TypedDict
  from gym import spaces
  from tianshou.data import ReplayBuffer, Batch, to_torch, to_numpy
  from tianshou.policy import BasePolicy, PPOPolicy
  from nni.mutable import Categorical, CategoricalMultiple, Mutable, MutableAnnotation, Sample
label_desc: Use image node_id 1 for calling a global function with example usage: default_policy_fn(env, lr, hidden_dim) and returns: PPOPolicy