code: def euler_angles_to_rotation_matrix(theta, random_order=False):
      R_x = torch.tensor(
          [
              [1, 0, 0],
              [0, torch.cos(theta[0]), -torch.sin(theta[0])],
              [0, torch.sin(theta[0]), torch.cos(theta[0])],
          ]
      )
  
      R_y = torch.tensor(
          [
              [torch.cos(theta[1]), 0, torch.sin(theta[1])],
              [0, 1, 0],
              [-torch.sin(theta[1]), 0, torch.cos(theta[1])],
          ]
      )
  
      R_z = torch.tensor(
          [
              [torch.cos(theta[2]), -torch.sin(theta[2]), 0],
              [torch.sin(theta[2]), torch.cos(theta[2]), 0],
              [0, 0, 1],
          ]
      )
  
      matrices = [R_x, R_y, R_z]
      if random_order:
          random.shuffle(matrices)
      R = torch.mm(matrices[2], torch.mm(matrices[1], matrices[0]))
      return R
  
imports: import torch
  import random
label_desc: Use image node_id 1 for calling a global function with example usage: euler_angles_to_rotation_matrix(theta, random_order) and returns: R