code: def get_flat_parameters(policy: TorchModel) -> torch.Tensor:
      """Get the parameters of all sub-policies as a single flat vector.
  
      :param policy: source policy
      :return: flattened parameters
      """
      flat_list = [torch.flatten(p) for p in policy.parameters()]
      flat = torch.cat(flat_list).view(-1)
  
      return flat
  
imports: import torch
  from maze.core.agent.torch_model import TorchModel
label_desc: Use image node_id 1 for calling a global function with example usage: get_flat_parameters(policy) and returns: flat