code: def batch_rodrigues(rot_vecs, epsilon=1e-8, dtype=torch.float32):
      """Calculates the rotation matrices for a batch of rotation vectors
      Parameters
      ----------
      rot_vecs: torch.tensor Nx3
          array of N axis-angle vectors
      Returns
      -------
      R: torch.tensor Nx3x3
          The rotation matrices for the given axis-angle parameters
      """
  
      batch_size = rot_vecs.shape[0]
      device = rot_vecs.device
  
      angle = torch.norm(rot_vecs + 1e-8, dim=1, keepdim=True)
      rot_dir = rot_vecs / angle
  
      cos = torch.unsqueeze(torch.cos(angle), dim=1)
      sin = torch.unsqueeze(torch.sin(angle), dim=1)
  
      # Bx1 arrays
      rx, ry, rz = torch.split(rot_dir, 1, dim=1)
      K = torch.zeros((batch_size, 3, 3), dtype=dtype, device=device)
  
      zeros = torch.zeros((batch_size, 1), dtype=dtype, device=device)
      K = torch.cat(
          [zeros, -rz, ry, rz, zeros, -rx, -ry, rx, zeros], dim=1
      ).view((batch_size, 3, 3))
  
      ident = torch.eye(3, dtype=dtype, device=device).unsqueeze(dim=0)
      rot_mat = ident + sin * K + (1 - cos) * torch.bmm(K, K)
      return rot_mat
  
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 8 for calling a global function with example usage: batch_rodrigues(rot_vecs, epsilon, dtype) and returns: rot_mat