code: def clip_boxes(boxes, window, name=None):
      """
      Args:
          boxes: nx4, xyxy
          window: [h, w]
      """
      boxes = tf.maximum(boxes, 0.0)
      m = tf.tile(tf.reverse(window, [0]), [2])  # (4,)
      boxes = tf.minimum(boxes, tf.cast(m, tf.float32), name=name)
      return boxes
  
file_path: tensorpack/examples/FasterRCNN/modeling/model_box.py
imports: import numpy
  import tensorflow
  from collections import namedtuple
  from tensorpack.tfutils.scope_utils import under_name_scope
  from config import config
label_desc: Use image node_id 1 for calling a global function with example usage: clip_boxes(boxes, window, name) and returns: boxes