class_docstr: Sampler implementation that converts predictions to GT using registered
  samplers for different fields of `Instances`.
docstr: Register sampler for a field
  
  Args:
    prediction_attr (str): field to replace with a sampled value
    gt_attr (Optional[str]): field to store the sampled value to, if not None
    func (Optional[Callable: Any -> Any]): sampler function
docstr_tok: ["Register","sampler","for","a","field","Args",":","prediction_attr","(","str",")",":","field","to","replace","with","a","sampled","value","gt_attr","(","Optional","[","str","]",")",":","field","to","store","the","sampled","value","to",",","if","not","None","func","(","Optional","[","Callable",":","Any","-",">","Any","]",")",":","sampler","function"]
code: def register_sampler(
      self,
      prediction_attr: str,
      gt_attr: Optional[str] = None,
      func: Optional[Callable[[Any], Any]] = None,
  ):
      """
      Register sampler for a field
  
      Args:
        prediction_attr (str): field to replace with a sampled value
        gt_attr (Optional[str]): field to store the sampled value to, if not None
        func (Optional[Callable: Any -> Any]): sampler function
      """
      self._samplers[(prediction_attr, gt_attr)] = _Sampler(
          src=prediction_attr, dst=gt_attr, func=func
      )
  
file_path: detectron2/projects/DensePose/densepose/data/samplers/prediction_to_gt.py
imports: from dataclasses import dataclass
  from typing import Any, Callable, Dict, List, Optional
  from detectron2.structures import Instances
label_desc: Use image node_id 3 for calling the PredictionToGroundTruthSampler obj's underlying member method code with example usage: obj.register_sampler(prediction_attr, gt_attr, func) without return types