code: def quat2rot(quats):
      """Convert a list of quaternions to rotation matrices."""
      rotation_matrices = []
      for frame_idx in range(quats.shape[0]):
          quat = quats[frame_idx]
          rotation_matrix = rotation_matrix_3d.from_quaternion(
              tf.concat([quat[1:], quat[0:1]], axis=0)
          )
          rotation_matrices.append(rotation_matrix)
      return tf.cast(tf.stack(rotation_matrices), tf.float32)
  
imports: import functools
  import itertools
  import matplotlib.pyplot
  import mediapy
  import numpy
  import tensorflow.compat.v1
  import tensorflow_datasets
  from tensorflow_graphics.geometry.transformation import rotation_matrix_3d
label_desc: Use image node_id 6 for calling a global function with example usage: quat2rot(quats) and returns: tf