import torch


def full_pose_3d(pose):
  """Expand (B, 12) pose to (B, 4, 4) transformation matrix."""
    
  shape = list(pose.shape[:-1])
  shape += [3, 4]
  pose = torch.reshape(pose, shape)
  zeros = torch.zeros_like(pose[..., :1, 0])
  last = torch.stack([zeros, zeros, zeros, zeros + 1], -1)
  full_pose = torch.cat([pose, last], -2)
  return full_pose