code: def latents_to_tensor(z):
      return torch.stack(
          [
              torch.cat((z_where.cpu().data, z_pres.cpu().data), 1)
              for z_where, z_pres in zip(*z)
          ]
      ).transpose(0, 1)
  
imports: from collections import namedtuple
  import torch
  import torch.nn
  import torch.nn.functional
  from modules import MLP, Decoder, Encoder, Identity, Predict
  import pyro
  import pyro.distributions
label_desc: Use image node_id 6 for calling a global function with example usage: latents_to_tensor(z) and returns: torch