class_docstr: Funsor that is constant wrt ``const_inputs``.
  
  :class:`Constant` can be used for provenance tracking.
  
  Examples::
  
      a = Constant(OrderedDict(x=Real, y=Bint[3]), Number(0))
      a(y=1)  # returns Constant(OrderedDict(x=Real), Number(0))
      a(x=2, y=1)  # returns Number(0)
  
      d = Tensor(torch.tensor([1, 2, 3]))["y"]
      a + d  # returns Constant(OrderedDict(x=Real), d)
  
      c = Constant(OrderedDict(x=Bint[3]), Number(1))
      c.reduce(ops.add, "x")  # returns Number(3)
  
  :param dict const_inputs: A mapping from input name (str) to datatype (``funsor.domain.Domain``).
  :param funsor arg: A funsor that is constant wrt to const_inputs.
class_docstr_tok: ["Funsor","that","is","constant","wrt","``","const_inputs","``",".",":","class",":","`","Constant","`","can","be","used","for","provenance","tracking",".","Examples",":",":","a","=","Constant","(","OrderedDict","(","x=Real",",","y=Bint","[","3","]",")",",","Number","(","0",")",")","a","(","y=1",")","#","returns","Constant","(","OrderedDict","(","x=Real",")",",","Number","(","0",")",")","a","(","x=2",",","y=1",")","#","returns","Number","(","0",")","d","=","Tensor","(","torch.tensor","(","[","1",",","2",",","3","]",")",")","[","``","y","''","]","a","+","d","#","returns","Constant","(","OrderedDict","(","x=Real",")",",","d",")","c","=","Constant","(","OrderedDict","(","x=Bint","[","3","]",")",",","Number","(","1",")",")","c.reduce","(","ops.add",",","``","x","''",")","#","returns","Number","(","3",")",":","param","dict","const_inputs",":","A","mapping","from","input","name","(","str",")","to","datatype","(","``","funsor.domain.Domain","``",")",".",":","param","funsor","arg",":","A","funsor","that","is","constant","wrt","to","const_inputs","."]
code: def __init__(self, const_inputs, arg):
      assert isinstance(arg, Funsor)
      assert isinstance(const_inputs, tuple)
      const_inputs = OrderedDict(const_inputs)
      # const_inputs and arg.inputs have to be disjoint
      assert set(const_inputs).isdisjoint(arg.inputs)
      inputs = const_inputs.copy()
      inputs.update(arg.inputs)
      output = arg.output
      fresh = frozenset(const_inputs)
      bound = {}
      super(Constant, self).__init__(inputs, output, fresh, bound)
      self.arg = arg
      self.const_vars = frozenset(
          Variable(k, v) for k, v in const_inputs.items()
      )
      self.const_inputs = const_inputs
  
file_path: funsor/funsor/constant.py
imports: from collections import OrderedDict
  from functools import reduce
  import funsor.ops
  from funsor.tensor import Tensor
  from funsor.terms import Binary, Funsor, FunsorMeta, Number, Reduce, Unary, Variable, eager
label_desc: Use image node_id 1 to create a new Constant object from inherited base classes: Funsor with example: obj = Constant(const_inputs, arg)