code: def get_leaf(graph: Graph):
      """
      Given a graph, return leaf nodes of this graph.
      Note: If we remove ``root`` nodes, ``placeholder`` nodes, and ``output`` nodes from fx graph,
      we will get a normal DAG. Leaf nodes in this context means leaf nodes in that DAG.
      """
      input_nodes: Dict[Node, None] = {}
      for node in graph.nodes:
          if node.op == "output":
              map_arg(node.args, lambda n: input_nodes.setdefault(n))
              map_arg(node.kwargs, lambda n: input_nodes.setdefault(n))
      placeholder_nodes = []
      for node in input_nodes.keys():
          if node.op == "placeholder":
              placeholder_nodes.append(node)
      for node in placeholder_nodes:
          input_nodes.pop(node)
      return list(input_nodes.keys())
  
file_path: colossalai/colossalai/fx/passes/utils.py
imports: from typing import Dict
  import torch
  from torch.fx.graph import Graph
  from torch.fx.node import Node, map_arg
label_desc: Use image node_id 2 for calling a global function with example usage: get_leaf(graph) and returns: list