class_docstr: Encapsulates multiple torch state action critics for training in structured environments.
  
  :param networks: Mapping of value functions (critic) to encapsulate.
  :param num_policies: The number of corresponding policies.
  :param device: Device the policy should be located on (cpu or cuda)
  :param only_discrete_spaces: A dict specifying if the action spaces w.r.t. the step only hold discrete action
                               spaces.
class_docstr_tok: ["Encapsulates","multiple","torch","state","action","critics","for","training","in","structured","environments",".",":","param","networks",":","Mapping","of","value","functions","(","critic",")","to","encapsulate",".",":","param","num_policies",":","The","number","of","corresponding","policies",".",":","param","device",":","Device","the","policy","should","be","located","on","(","cpu","or","cuda",")",":","param","only_discrete_spaces",":","A","dict","specifying","if","the","action","spaces","w.r.t",".","the","step","only","hold","discrete","action","spaces","."]
docstr: Reinitialize all parameters of the network.
docstr_tok: ["Reinitialize","all","parameters","of","the","network","."]
code: def re_init_networks(self) -> None:
      """Reinitialize all parameters of the network."""
      for key, critic in self.networks.items():
          # initialize model weights
          if isinstance(critic, InferenceBlock):
              critic.apply(make_module_init_normc(1.0))
              for block_key in critic.perception_dict:
                  if block_key == "q_value" or block_key.endswith(
                      "_q_values"
                  ):
                      critic.perception_dict[block_key].apply(
                          make_module_init_normc(0.01)
                      )
          else:
              inference_blocks = list(
                  filter(
                      lambda cc: isinstance(cc, InferenceBlock),
                      critic.children(),
                  )
              )
              if len(inference_blocks) == 1:
                  inference_blocks[0].apply(make_module_init_normc(1.0))
                  for block_key in inference_blocks[0].perception_dict:
                      if block_key == "q_value" or block_key.endswith(
                          "_q_values"
                      ):
                          inference_blocks[0].perception_dict[
                              block_key
                          ].apply(make_module_init_normc(0.01))
              else:
                  BColors.print_colored(
                      f"More or less than one inference block was found for"
                      f" {key}, therefore the model could not be reinitialized",
                      BColors.WARNING,
                  )
  
imports: import copy
  import itertools
  from abc import abstractmethod
  from typing import Mapping, Union, List, Dict
  import torch
  from gym import spaces
  from torch import nn
  from torch.distributions.utils import logits_to_probs
  from maze.core.agent.state_action_critic import StateActionCritic
  from maze.core.agent.torch_model import TorchModel
  from maze.core.annotations import override
  from maze.core.wrappers.observation_preprocessing.preprocessors.one_hot import OneHotPreProcessor
  from maze.perception.blocks.inference import InferenceBlock
  from maze.perception.perception_utils import flatten_spaces, convert_to_numpy, convert_to_torch
  from maze.perception.weight_init import make_module_init_normc
  from maze.utils.bcolors import BColors
label_desc: Use image node_id 16 for calling the TorchStateActionCritic obj's underlying member method code with example usage: obj.re_init_networks() without return types