code: def get_roi_features(features, bboxes, roi_extractor):
      rois_list = [
          bboxes[i] for i in range(len(bboxes)) if len(bboxes[i]) > 0
      ]
      rois_num = paddle.to_tensor(
          [len(bboxes[i]) for i in range(len(bboxes))], dtype="int32"
      )
  
      pos_ids = paddle.cast(rois_num, dtype="bool")
      if pos_ids.sum() != len(rois_num):
          rois_num = rois_num[pos_ids]
          features = [
              features[i][pos_ids] for i in range(len(features))
          ]
  
      return roi_extractor(features, rois_list, rois_num)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import paddle
  from paddle import nn
  from ppdet.core.workspace import register
  from ppdet.modeling import initializer
  from .roi_extractor import RoIAlign
  from ..bbox_utils import delta2bbox_v2
  from ..cls_utils import _get_class_default_kwargs
  from ..layers import MultiHeadAttention
label_desc: Use image node_id 3 for calling the SparseRoIHead obj's underlying member method code with example usage: obj.get_roi_features(features, bboxes, roi_extractor) and returns: roi_extractor