code: def clip_to_window(boxlist, window):
      """Clip bounding boxes to a window.
  
      This op clips input bounding boxes (represented by bounding box
      corners) to a window, optionally filtering out boxes that do not
      overlap at all with the window.
  
      Args:
        boxlist: BoxList holding M_in boxes
        window: a numpy array of shape [4] representing the
                [y_min, x_min, y_max, x_max] window to which the op
                should clip boxes.
  
      Returns:
        a BoxList holding M_out boxes where M_out <= M_in
      """
      y_min, x_min, y_max, x_max = np.array_split(
          boxlist.get(), 4, axis=1
      )
      win_y_min = window[0]
      win_x_min = window[1]
      win_y_max = window[2]
      win_x_max = window[3]
      y_min_clipped = np.fmax(np.fmin(y_min, win_y_max), win_y_min)
      y_max_clipped = np.fmax(np.fmin(y_max, win_y_max), win_y_min)
      x_min_clipped = np.fmax(np.fmin(x_min, win_x_max), win_x_min)
      x_max_clipped = np.fmax(np.fmin(x_max, win_x_max), win_x_min)
      clipped = np_box_list.BoxList(
          np.hstack(
              [
                  y_min_clipped,
                  x_min_clipped,
                  y_max_clipped,
                  x_max_clipped,
              ]
          )
      )
      clipped = _copy_extra_fields(clipped, boxlist)
      areas = area(clipped)
      nonzero_area_indices = np.reshape(
          np.nonzero(np.greater(areas, 0.0)), [-1]
      ).astype(np.int32)
      return gather(clipped, nonzero_area_indices)
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import numpy
  from .None import np_box_list, np_box_ops
label_desc: Use image node_id 10 for calling a global function with example usage: clip_to_window(boxlist, window) and returns: gather