code: def roi_align(featuremap, boxes, resolution):
      
      # sample 4 locations per roi bin
      ret = crop_and_resize(
          featuremap, boxes,
          tf.zeros([tf.shape(boxes)[0]], dtype=tf.int32),
          resolution * 2)
      ret = tf.nn.avg_pool(ret, [1, 1, 2, 2], [1, 1, 2, 2], padding='SAME', data_format='NCHW')
      return ret
docs: Args:
          featuremap: 1xCxHxW
          boxes: Nx4 floatbox
          resolution: output spatial resolution
  
      Returns:
          NxCx res x res