class_docstr: `PointRend <https://arxiv.org/abs/1912.08193>`_.
class_docstr_tok: ["`","PointRend","<","https",":","\/\/arxiv.org\/abs\/1912.08193",">","`","_","."]
docstr: Sample fine grained feats from each level feature map and
  concatenate them together.
  
  Args:
      x (tuple[Tensor]): Feature maps of all scale level.
      rois (Tensor): shape (num_rois, 5).
      rel_roi_points (Tensor): A tensor of shape (num_rois, num_points,
          2) that contains [0, 1] x [0, 1] normalized coordinates of the
          most uncertain points from the [mask_height, mask_width] grid.
  
  Returns:
      Tensor: The fine grained features for each points,
      has shape (num_rois, feats_channels, num_points).
docstr_tok: ["Sample","fine","grained","feats","from","each","level","feature","map","and","concatenate","them","together",".","Args",":","x","(","tuple","[","Tensor","]",")",":","Feature","maps","of","all","scale","level",".","rois","(","Tensor",")",":","shape","(","num_rois",",","5",")",".","rel_roi_points","(","Tensor",")",":","A","tensor","of","shape","(","num_rois",",","num_points",",","2",")","that","contains","[","0",",","1","]","x","[","0",",","1","]","normalized","coordinates","of","the","most","uncertain","points","from","the","[","mask_height",",","mask_width","]","grid",".","Returns",":","Tensor",":","The","fine","grained","features","for","each","points",",","has","shape","(","num_rois",",","feats_channels",",","num_points",")","."]
code: def _get_fine_grained_point_feats(
      self, x: Tuple[Tensor], rois: Tensor, rel_roi_points: Tensor
  ) -> Tensor:
      """Sample fine grained feats from each level feature map and
      concatenate them together.
  
      Args:
          x (tuple[Tensor]): Feature maps of all scale level.
          rois (Tensor): shape (num_rois, 5).
          rel_roi_points (Tensor): A tensor of shape (num_rois, num_points,
              2) that contains [0, 1] x [0, 1] normalized coordinates of the
              most uncertain points from the [mask_height, mask_width] grid.
  
      Returns:
          Tensor: The fine grained features for each points,
          has shape (num_rois, feats_channels, num_points).
      """
      assert rois.shape[0] > 0, "RoI is a empty tensor."
      num_imgs = x[0].shape[0]
      fine_grained_feats = []
      for idx in range(self.mask_roi_extractor.num_inputs):
          feats = x[idx]
          spatial_scale = 1.0 / float(
              self.mask_roi_extractor.featmap_strides[idx]
          )
          point_feats = []
          for batch_ind in range(num_imgs):
              # unravel batch dim
              feat = feats[batch_ind].unsqueeze(0)
              inds = rois[:, 0].long() == batch_ind
              if inds.any():
                  rel_img_points = rel_roi_point_to_rel_img_point(
                      rois=rois[inds],
                      rel_roi_points=rel_roi_points[inds],
                      img=feat.shape[2:],
                      spatial_scale=spatial_scale,
                  ).unsqueeze(0)
                  point_feat = point_sample(feat, rel_img_points)
                  point_feat = point_feat.squeeze(0).transpose(0, 1)
                  point_feats.append(point_feat)
          fine_grained_feats.append(torch.cat(point_feats, dim=0))
      return torch.cat(fine_grained_feats, dim=1)
  
file_path: mmdetection/mmdet/models/roi_heads/point_rend_roi_head.py
imports: from typing import List, Tuple
  import torch
  import torch.nn.functional
  from mmcv.ops import point_sample, rel_roi_point_to_rel_img_point
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures.bbox import bbox2roi
  from mmdet.utils import ConfigType, InstanceList
  from ..task_modules.samplers import SamplingResult
  from ..utils import empty_instances
  from .standard_roi_head import StandardRoIHead
label_desc: Use image node_id 6 for calling the PointRendRoIHead obj's underlying member method code with example usage: obj._get_fine_grained_point_feats(x, rois, rel_roi_points) and returns: torch