code: def create_extrinsics_with_rotation(
      alphas, betas, gammas, txs, tys, tzs, device, dtype
  ):
      extrinsics_batch = []
      for alpha, beta, gamma, tx, ty, tz in zip(
          alphas, betas, gammas, txs, tys, tzs
      ):
          Rx = torch.eye(3, device=device, dtype=dtype)
          Rx[1, 1] = math.cos(alpha)
          Rx[1, 2] = math.sin(alpha)
          Rx[2, 1] = -Rx[1, 2]
          Rx[2, 2] = Rx[1, 1]
  
          Ry = torch.eye(3, device=device, dtype=dtype)
          Ry[0, 0] = math.cos(beta)
          Ry[0, 2] = -math.sin(beta)
          Ry[2, 0] = -Ry[0, 2]
          Ry[2, 2] = Ry[0, 0]
  
          Rz = torch.eye(3, device=device, dtype=dtype)
          Rz[0, 0] = math.cos(gamma)
          Rz[0, 1] = math.sin(gamma)
          Rz[1, 0] = -Rz[0, 1]
          Rz[1, 1] = Rz[0, 0]
  
          Ryz = torch.matmul(Ry, Rz)
          R = torch.matmul(Rx, Ryz)
  
          extrinsics = torch.eye(4, device=device, dtype=dtype)
          extrinsics[..., 0, -1] = tx
          extrinsics[..., 1, -1] = ty
          extrinsics[..., 2, -1] = tz
          extrinsics[:3, :3] = R
  
          extrinsics_batch.append(extrinsics)
      return torch.stack(extrinsics_batch)
  
imports: import math
  import torch
  from kornia.core import Device
  from kornia.geometry.camera import PinholeCamera
  from kornia.nerf.samplers import RandomGridRaySampler, RandomRaySampler, UniformRaySampler, calc_ray_t_vals, cameras_for_ids, sample_lengths, sample_ray_points
  from kornia.testing import assert_close
label_desc: Use image node_id 3 for calling a global function with example usage: create_extrinsics_with_rotation(alphas, betas, gammas, txs, tys, tzs, device, dtype) and returns: torch