class_docstr: Encapsulates multiple torch policies along with a distribution mapper for training and rollouts
  in structured environments.
  
  :param networks: Mapping of policy networks to encapsulate
  :param distribution_mapper: Distribution mapper associated with the policy mapping.
  :param device: Device the policy should be located on (cpu or cuda)
class_docstr_tok: ["Encapsulates","multiple","torch","policies","along","with","a","distribution","mapper","for","training","and","rollouts","in","structured","environments",".",":","param","networks",":","Mapping","of","policy","networks","to","encapsulate",":","param","distribution_mapper",":","Distribution","mapper","associated","with","the","policy","mapping",".",":","param","device",":","Device","the","policy","should","be","located","on","(","cpu","or","cuda",")"]
docstr: implementation of :class:`~maze.core.agent.torch_model.TorchModel`
          
docstr_tok: ["implementation","of",":","class",":","`","~maze.core.agent.torch_model.TorchModel","`"]
code: def train(self) -> None:
      """implementation of :class:`~maze.core.agent.torch_model.TorchModel`"""
      for policy in self.networks.values():
          policy.train()
  
imports: from typing import Mapping, Union, List, Dict, Tuple, Sequence, Optional
  import torch
  from torch import nn
  from maze.core.agent.policy import Policy
  from maze.core.agent.torch_model import TorchModel
  from maze.core.agent.torch_policy_output import PolicySubStepOutput, PolicyOutput
  from maze.core.annotations import override
  from maze.core.env.action_conversion import ActionType
  from maze.core.env.base_env import BaseEnv
  from maze.core.env.maze_state import MazeStateType
  from maze.core.env.observation_conversion import ObservationType
  from maze.core.env.structured_env import ActorID, StepKeyType
  from maze.core.trajectory_recording.records.structured_spaces_record import StructuredSpacesRecord
  from maze.distributions.categorical import CategoricalProbabilityDistribution
  from maze.distributions.distribution_mapper import DistributionMapper
  from maze.perception.perception_utils import convert_to_torch, convert_to_numpy
label_desc: Use image node_id 6 for calling the TorchPolicy obj's underlying member method code with example usage: obj.train() without return types