code: def compute_argmax_tensor(model, approx_vars):
      approx_vars = approx_vars.intersection(model.input_vars)
      if not approx_vars:
          return {}
  
      # Partition inputs into batch_inputs + event_inputs.
      approx_names = frozenset(v.name for v in approx_vars)
      batch_inputs = OrderedDict()
      event_inputs = OrderedDict()
      for k, d in model.inputs.items():
          if k in approx_names:
              event_inputs[k] = d
          else:
              batch_inputs[k] = d
      inputs = batch_inputs.copy()
      inputs.update(event_inputs)
      data = align_tensor(inputs, model)
  
      # Flatten and compute single argmax.
      batch_shape = data.shape[: len(batch_inputs)]
      flat_data = data.reshape(batch_shape + (-1,))
      flat_point = ops.argmax(flat_data, -1)
      assert flat_point.shape == batch_shape
  
      # Unflatten into deltas
      result = {}
      mod_point = flat_point
      for name, domain in reversed(list(event_inputs.items())):
          size = domain.dtype
          result[name] = Tensor(mod_point % size, batch_inputs, size)
          mod_point = mod_point // size
      return result
  
imports: from collections import OrderedDict
  from functools import reduce, singledispatch
  from funsor.cnf import Contraction, GaussianMixture
  from funsor.delta import Delta
  from funsor.gaussian import Gaussian, _compute_offsets
  from funsor.instrument import debug_logged
  from funsor.integrate import Integrate
  from funsor.interpretations import DispatchedInterpretation
  from funsor.tensor import Tensor, align_tensor
  from funsor.terms import Approximate, Funsor
  from funsor.typing import deep_isinstance
  from .None import ops
label_desc: Use image node_id 6 for calling a global function with example usage: compute_argmax_tensor(model, approx_vars) and returns: result, dict