code: def batch_rigid_transform(
      rot_mats, joints, parents, dtype=torch.float32
  ):
      """
      Applies a batch of rigid transformations to the joints
  
      Parameters
      ----------
      rot_mats : torch.tensor BxNx3x3
          Tensor of rotation matrices
      joints : torch.tensor BxNx3
          Locations of joints
      parents : torch.tensor BxN
          The kinematic tree of each object
      dtype : torch.dtype, optional:
          The data type of the created tensors, the default is torch.float32
  
      Returns
      -------
      posed_joints : torch.tensor BxNx3
          The locations of the joints after applying the pose rotations
      rel_transforms : torch.tensor BxNx4x4
          The relative (with respect to the root joint) rigid transformations
          for all the joints
      """
  
      joints = torch.unsqueeze(joints, dim=-1)
  
      rel_joints = joints.clone()
      rel_joints[:, 1:] -= joints[:, parents[1:]]
  
      transforms_mat = (
          transform_mat(
              rot_mats.contiguous().view(-1, 3, 3),
              rel_joints.contiguous().view(-1, 3, 1),
          )
          .contiguous()
          .view(-1, joints.shape[1], 4, 4)
      )
  
      transform_chain = [transforms_mat[:, 0]]
      for i in range(1, parents.shape[0]):
          # Subtract the joint location at the rest pose
          # No need for rotation, since it's identity when at rest
          curr_res = torch.matmul(
              transform_chain[parents[i]], transforms_mat[:, i]
          )
          transform_chain.append(curr_res)
  
      transforms = torch.stack(transform_chain, dim=1)
  
      # The last column of the transformations contains the posed joints
      posed_joints = transforms[:, :, :3, 3]
  
      joints_homogen = F.pad(joints, [0, 0, 0, 1])
  
      rel_transforms = transforms - F.pad(
          torch.matmul(transforms, joints_homogen),
          [3, 0, 0, 0, 0, 0, 0, 0],
      )
  
      return posed_joints, rel_transforms
  
imports: from __future__ import absolute_import
  from __future__ import print_function
  from __future__ import division
  import os.path
  import pickle
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 10 for calling a global function with example usage: batch_rigid_transform(rot_mats, joints, parents, dtype) and returns: posed_joints,  rel_transforms