class_docstr: A callback to rewrite repeated scatters with a batched gather.
class_docstr_tok: ["A","callback","to","rewrite","repeated","scatters","with","a","batched","gather","."]
code: def __init__(self, num_scales):
      super().__init__()
      self.num_scales = num_scales
      self.levels = wildcard()
      self.roi_align_results = []
      for _ in range(num_scales):
          self.roi_align_results.append(wildcard())
  
      self.pattern = scatter_roi_align_result_pattern(
          self.levels, self.roi_align_results, num_scales
      )
  
imports: from ..None import expr
  from ..None import op
  from ..dataflow_pattern import wildcard, is_constant, is_op, rewrite, is_tuple, is_tuple_get_item, is_if, DFPatternCallback
label_desc: Use image node_id 1 to create a new ScatterRewrite object from inherited base classes: DFPatternCallback with example: obj = ScatterRewrite(num_scales)