class_docstr: Base DensePose sampler to produce DensePose data from DensePose predictions.
  Samples for each class are drawn according to some distribution over all pixels estimated
  to belong to that class.
docstr: Convert DensePose predictor output to segmentation annotation - tensors of size
  (256, 256) and type `int64`.
  
  Args:
      output: DensePose predictor output with the following attributes:
       - coarse_segm: tensor of size [N, D, H, W] with unnormalized coarse
         segmentation scores
  Return:
      Tensor of size (S, S) and type `int64` with coarse segmentation annotations,
      where S = DensePoseDataRelative.MASK_SIZE
docstr_tok: ["Convert","DensePose","predictor","output","to","segmentation","annotation","-","tensors","of","size","(","256",",","256",")","and","type","`","int64","`",".","Args",":","output",":","DensePose","predictor","output","with","the","following","attributes",":","-","coarse_segm",":","tensor","of","size","[","N",",","D",",","H",",","W","]","with","unnormalized","coarse","segmentation","scores","Return",":","Tensor","of","size","(","S",",","S",")","and","type","`","int64","`","with","coarse","segmentation","annotations",",","where","S","=","DensePoseDataRelative.MASK_SIZE"]
code: def _resample_mask(self, output: Any) -> torch.Tensor:
      """
      Convert DensePose predictor output to segmentation annotation - tensors of size
      (256, 256) and type `int64`.
  
      Args:
          output: DensePose predictor output with the following attributes:
           - coarse_segm: tensor of size [N, D, H, W] with unnormalized coarse
             segmentation scores
      Return:
          Tensor of size (S, S) and type `int64` with coarse segmentation annotations,
          where S = DensePoseDataRelative.MASK_SIZE
      """
      sz = DensePoseDataRelative.MASK_SIZE
      mask = (
          F.interpolate(
              output.coarse_segm,
              (sz, sz),
              mode="bilinear",
              align_corners=False,
          )
          .argmax(dim=1)
          .long()
          .squeeze()
          .cpu()
      )
      return mask
  
file_path: detectron2/projects/DensePose/densepose/data/samplers/densepose_cse_base.py
imports: from typing import Any, Dict, List, Tuple
  import torch
  from torch.nn import functional
  from detectron2.config import CfgNode
  from detectron2.structures import Instances
  from densepose.converters.base import IntTupleBox
  from densepose.data.utils import get_class_to_mesh_name_mapping
  from densepose.modeling.cse.utils import squared_euclidean_distance_matrix
  from densepose.structures import DensePoseDataRelative
  from .densepose_base import DensePoseBaseSampler
label_desc: Use image node_id 4 for calling the DensePoseCSEBaseSampler obj's underlying member method code with example usage: obj._resample_mask(output) and returns: mask