code: def set_flat_parameters(
      policy: TorchModel, flat_params: torch.Tensor
  ) -> None:
      """Overwrite the parameters of all sub-policies by a single flat vector.
  
      :param policy: target policy
      :param flat_params: concatenated vector
      """
      start = 0
      for p in policy.parameters():
          end = start + p.numel()
          p[...] = flat_params[start:end].view(*p.shape)
          start = end
  
imports: import torch
  from maze.core.agent.torch_model import TorchModel
label_desc: Use image node_id 2 for calling a global function with example usage: set_flat_parameters(policy, flat_params) without return types