code: def assign_valid_boxes_mask_targets(
      gt_box_batch, gt_num_boxes_batch, image_size, stride
  ):
      """Assign valid boxes."""
      height, width = image_size
  
      def _create_mask(elems):
          gt_boxes = elems[0]
          gt_num_boxes = elems[1]
  
          num_boxes = tf.cast(gt_num_boxes, tf.int32)
  
          valid_boxes = valid_bounding_boxes_mask(
              gt_boxes[:num_boxes, ...],
              height // stride,
              width // stride,
          )
          mask = tf.concat(
              [
                  valid_boxes,
                  tf.zeros(tf.shape(gt_boxes)[0] - num_boxes),
              ],
              axis=0,
          )
          return mask
  
      # _create_mask((gt_box_batch[0, ...], gt_num_boxes_batch[0, ...]))
      return tf.map_fn(
          _create_mask,
          (gt_box_batch, gt_num_boxes_batch),
          dtype=tf.float32,
      )
  
file_path: graphics/tensorflow_graphics/projects/points_to_3Dobjects/transforms/targets.py
imports: import tensorflow
  from google3.third_party.tensorflow_models.object_detection.core import box_list
  from google3.third_party.tensorflow_models.object_detection.core import box_list_ops
label_desc: Use image node_id 8 for calling a global function with example usage: assign_valid_boxes_mask_targets(gt_box_batch, gt_num_boxes_batch, image_size, stride) and returns: tf, mask