code: def rotate_surface_normals(
      world_frame_normals,
      point_3d,
      cam_pos,
      obj_rot_mats,
      frame_for_query,
  ):
      """Points are occluded if the surface normal points away from the camera."""
      query_obj_rot_mat = tf.gather(obj_rot_mats, frame_for_query)
      obj_frame_normals = tf.einsum(
          "boi,bi->bo",
          tf.linalg.inv(query_obj_rot_mat),
          world_frame_normals,
      )
      world_frame_normals_frames = tf.einsum(
          "foi,bi->bfo",
          obj_rot_mats,
          obj_frame_normals,
      )
      cam_to_pt = point_3d - cam_pos[tf.newaxis, :, :]
      dots = tf.reduce_sum(
          world_frame_normals_frames * cam_to_pt, axis=-1
      )
      faces_away = dots > 0
  
      # If the query point also faces away, it's probably a bug in the meshes, so
      # ignore the result of the test.
      faces_away_query = tf.reduce_sum(
          tf.cast(faces_away, tf.int32)
          * tf.one_hot(
              frame_for_query, tf.shape(faces_away)[1], dtype=tf.int32
          ),
          axis=1,
          keepdims=True,
      )
      faces_away = tf.logical_and(
          faces_away, tf.logical_not(faces_away_query > 0)
      )
      return faces_away
  
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 7 for calling a global function with example usage: rotate_surface_normals(world_frame_normals, point_3d, cam_pos, obj_rot_mats, frame_for_query) and returns: faces_away