You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes it is useful to keep track of certain Funsor inputs even though the underlying Funsor is constant wrt to those inputs. Examples are Zero terms in Delta.eager_reduce and In contrib.funsor.TraceEnum_ELBO. This is currently implemented as expanded Tensor terms which is memory/computation inefficient and only allows Bint input type. Proposed Constant funsor has following benefits:
Declare constant inputs of a Funsor in a memory efficient way: e.g. Constant(cost.inputs, Number(0))
Allow variables with Real output type: e.g. Constant(OrderedDict(x=Bint[3], y=Real), Number(0))
Define computationally efficient patterns for subs/reduce/unary/binary operations
Convert to and from ProvenanceTensor (ProvenanceTensor #543) where provenance of the tensor corresponds to const_inputs. Edit: I don’t think this is correct, the counterpart of ProvenanceTensor should something similar to Delta.
The argument in Constant(const_inputs, arg) doesn't have to be a Number. It can be any Funsor with the condition that const_inputs and arg.inputs have to be disjoint.
The main motivation is to use Constant as a wrapper for ProvenanceTensor and as targets for log_measures in a general version of contrib.fusor.Trace_ELBO (pyro-ppl/pyro#2893).
The text was updated successfully, but these errors were encountered:
Sometimes it is useful to keep track of certain Funsor inputs even though the underlying Funsor is constant wrt to those inputs. Examples are Zero terms in
Delta.eager_reduce
and Incontrib.funsor.TraceEnum_ELBO
. This is currently implemented as expanded Tensor terms which is memory/computation inefficient and only allowsBint
input type. ProposedConstant
funsor has following benefits:Constant(cost.inputs, Number(0))
Real
output type: e.g.Constant(OrderedDict(x=Bint[3], y=Real), Number(0))
subs/reduce/unary/binary
operationsProvenanceTensor
(ProvenanceTensor #543) where provenance of the tensor corresponds toconst_inputs
. Edit: I don’t think this is correct, the counterpart ofProvenanceTensor
should something similar toDelta
.The argument in
Constant(const_inputs, arg)
doesn't have to be aNumber
. It can be any Funsor with the condition thatconst_inputs
andarg.inputs
have to be disjoint.The main motivation is to use
Constant
as a wrapper forProvenanceTensor
and as targets forlog_measures
in a general version ofcontrib.fusor.Trace_ELBO
(pyro-ppl/pyro#2893).The text was updated successfully, but these errors were encountered: