code: def get_ancestors(node):
      ancestors = set()
      cur_nodes = [node]
      while len(cur_nodes) > 0:
          new_nodes = []
          for node in cur_nodes:
              for inp in node.inverse_users:
                  if inp not in ancestors:
                      ancestors.add(inp)
                      new_nodes.append(inp)
          cur_nodes = new_nodes
      return ancestors
  
file_path: pytorch/torch/_inductor/comms.py
imports: from typing import List
  import torch
  from .None import config, ir, scheduler
  from .dependencies import WeakDep
  from .utils import tuple_sorted
label_desc: Use image node_id 3 for calling a global function with example usage: get_ancestors(node) and returns: ancestors