Closed fritzo closed 3 years ago
@eb8680 finally got the tests to pass 😓
For some reason, I am getting
E AttributeError: 'DirichletMultinomial' object has no attribute 'data'
in NumPyro test/test_handlers.py::test_collapse_beta_binomial
. The instance DirichletMultinomial
has the value
DirichletMultinomial(concentration=[1.5 0.5], total_count=10.0, value=Finitary(stack, (Tensor(7.0, OrderedDict(), 'real'), Number(3.0))))
@eb8680, @fehiepsi's issue with DirichletMultinomial
sounds related to the lazy test we disabled. Do you think we should try to get that working again?
Yeah, enabling it raises two errors
NotImplementedError: inhomogeneous total_count is not supported
(only with torch
backend)NotImplementedError: TODO support converting Indep(Transform)
but it seems to me refactoring of stack
is more relevant.
Addresses #489 partly pair coded with @eb8680
This major op refactoring aims to unblock @ordabayevy in #477 and #482 by allowing ops to have arbitrary *arg,**kwarg parameters. Changes include:
nullop
is renamed tonull
for consistency (NullOp
remains unchanged).@make_op
has moved to a classmethod@MyOpClass.make
e.g.@BinaryOp.make
.arity
attribute.[:arity]
-many args (and patterns are validated to ensure this).WeakValueDict
..subclass_register()
handlers have a different inferface, now includingcls
.WrappedTransformOp
class, and its instances each have an op.ops.WrappedTransformOp(fn)
must now be written as a kwargops.WrappedTransformOp(fn=fn)
is_numeric_array()
is demoted from anOp
to a@singledispatch
.ops.stack
interface has changed toops.stack(parts, dim)
as in NumPy and PyTorch.funsor.tensor.stack
is replaced byops.stack
.ops.einsum
interface has changed toops.einsum(operands, equation)
whereoperands
is a list or tuple.Finitary
funsor interface has changed from variously-many args to a single tuple arg.Tested