class_docstr: RoIHead for `SCNet <https://arxiv.org/abs/2012.10150>`_.
  
  Args:
      num_stages (int): number of cascade stages.
      stage_loss_weights (list): loss weight of cascade stages.
      semantic_roi_extractor (dict): config to init semantic roi extractor.
      semantic_head (dict): config to init semantic head.
      feat_relay_head (dict): config to init feature_relay_head.
      glbctx_head (dict): config to init global context head.
docstr: Fuse global context feats with roi feats.
  
  Args:
      roi_feats (Tensor): RoI features.
      glbctx_feat (Tensor): Global context feature..
      rois (Tensor): RoIs with the shape (n, 5) where the first
          column indicates batch id of each RoI.
  
  Returns:
      Tensor: Fused feature.
docstr_tok: ["Fuse","global","context","feats","with","roi","feats",".","Args",":","roi_feats","(","Tensor",")",":","RoI","features",".","glbctx_feat","(","Tensor",")",":","Global","context","feature","..","rois","(","Tensor",")",":","RoIs","with","the","shape","(","n",",","5",")","where","the","first","column","indicates","batch","id","of","each","RoI",".","Returns",":","Tensor",":","Fused","feature","."]
code: def _fuse_glbctx(
      self, roi_feats: Tensor, glbctx_feat: Tensor, rois: Tensor
  ) -> Tensor:
      """Fuse global context feats with roi feats.
  
      Args:
          roi_feats (Tensor): RoI features.
          glbctx_feat (Tensor): Global context feature..
          rois (Tensor): RoIs with the shape (n, 5) where the first
              column indicates batch id of each RoI.
  
      Returns:
          Tensor: Fused feature.
      """
      assert roi_feats.size(0) == rois.size(0)
      # RuntimeError: isDifferentiableType(variable.scalar_type())
      # INTERNAL ASSERT FAILED if detach() is not used when calling
      # roi_head.predict().
      img_inds = torch.unique(
          rois[:, 0].detach().cpu(), sorted=True
      ).long()
      fused_feats = torch.zeros_like(roi_feats)
      for img_id in img_inds:
          inds = rois[:, 0] == img_id.item()
          fused_feats[inds] = roi_feats[inds] + glbctx_feat[img_id]
      return fused_feats
  
imports: from typing import List, Optional, Tuple
  import torch
  import torch.nn.functional
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.structures.bbox import bbox2roi
  from mmdet.utils import ConfigType, InstanceList, OptConfigType
  from ..layers import adaptive_avg_pool2d
  from ..task_modules.samplers import SamplingResult
  from ..utils import empty_instances, unpack_gt_instances
  from .cascade_roi_head import CascadeRoIHead
label_desc: Use image node_id 6 for calling the SCNetRoIHead obj's underlying member method code with example usage: obj._fuse_glbctx(roi_feats, glbctx_feat, rois) and returns: fused_feats