code: def affine_inputs(fn):
      """
      Returns a [sound sub]set of real inputs of ``fn``
      wrt which ``fn`` is known to be affine.
  
      :param Funsor fn: A funsor.
      :return: A set of input names wrt which ``fn`` is affine.
      :rtype: frozenset
      """
      result = getattr(fn, "_affine_inputs", None)
      if result is None:
          result = fn._affine_inputs = _affine_inputs(fn)
      return result
  
file_path: funsor/funsor/affine.py
imports: from collections import OrderedDict
  from functools import reduce, singledispatch
  import opt_einsum
  from funsor.domains import Bint
  from funsor.interpreter import gensym
  from funsor.tensor import Tensor, get_default_prototype
  from funsor.terms import Binary, Finitary, Funsor, Lambda, Reduce, Unary, Variable
  from .None import ops
label_desc: Use image node_id 3 for calling a global function with example usage: affine_inputs(fn) and returns: result