code: def vars_by_fanout(jaxpr: core.Jaxpr):
      def fmt_key(var, eqn):
          if eqn is None:
              return f"{var} <- invar"
          else:
              src = source_info_util.summarize(eqn.source_info)
              return f"{var} <- {eqn.primitive.name} @ {src}"
  
      def hist(jaxpr, reads):
          return {
              fmt_key(var, var_def): len(var_refs)
              for var, var_def, var_refs in reads
          }
  
      return [
          (j, hist(j, reads)) for j, reads in var_defs_and_refs(jaxpr)
      ]
  
imports: from __future__ import annotations
  from collections import Counter, defaultdict
  import gzip
  import itertools
  import json
  import types
  from typing import Any, Callable, Union
  from jax._src import core
  from jax._src import util
  from jax._src import source_info_util
  from jax._src.lib import xla_client
label_desc: Use image node_id 9 for calling a global function with example usage: vars_by_fanout(jaxpr) and returns: unknown, unknown, var, str, var, str, eqn, str, src