code: def _(fn):
      if fn.op in (ops.add, ops.sub):
          return affine_inputs(fn.lhs) | affine_inputs(fn.rhs)
      if fn.op is ops.truediv:
          return affine_inputs(fn.lhs) - _real_inputs(fn.rhs)
      if isinstance(fn.op, ops.GetitemOp):
          return affine_inputs(fn.lhs)
      if fn.op in (ops.mul, ops.matmul):
          lhs_affine = affine_inputs(fn.lhs) - _real_inputs(fn.rhs)
          rhs_affine = affine_inputs(fn.rhs) - _real_inputs(fn.lhs)
          if not lhs_affine:
              return rhs_affine
          if not rhs_affine:
              return lhs_affine
          # This multilinear case introduces incompleteness, since some vars
          # could later be reduced, making remaining vars affine.
          return frozenset()
      return frozenset()
  
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 7 for calling a global function with example usage: _(fn) and returns: frozenset, unknown, unknown, affine_inputs, frozenset, rhs_affine, lhs_affine