Model broken: models/transform/simplex

12 views
Skip to first unread message

Daniel Lee

unread,
Feb 4, 2013, 11:21:57 PM2/4/13
to stan...@googlegroups.com
I haven't checked to see what's going on yet, but models/transform/simplex is failing.


$ models/transforms/simplex
Exception: vari destruction handled automatically
Diagnostic information:
Dynamic exception type: std::logic_error
std::exception::what: vari destruction handled automatically


Daniel

Daniel Lee

unread,
Feb 5, 2013, 10:45:02 AM2/5/13
to stan...@googlegroups.com
I fixed it. It was in the generated code Bob and I worked on yesterday.

The generated code went from:

stan::agrad::vari DUMMY_VARI__(std::numeric_limits<double>::quiet_NaN(),false);
stan::agrad::vari* DUMMY_VARI_PTR__ = &DUMMY_VARI__;
stan::agrad::var DUMMY_VAR__ = var(DUMMY_VARI_PTR__);

to:

stan::agrad::vari* DUMMY_VARI_PTR__ = new vari(std::numeric_limits<double>::quiet_NaN(),false);
stan::agrad::var DUMMY_VAR__ = var(DUMMY_VARI_PTR__);


That call to new() is using the arena based allocator. There is no leak by not deleting it. It avoids the problem of having DUMMY_VARI__ trigger the std::logic_error on automatic destruction.

As far as I can tell, we can't push the allocation of the vari into the class somewhere because it will be "deallocated" when the gradient is calculated.

Anyone see any problems with this change?




Daniel



Marcus Brubaker

unread,
Feb 5, 2013, 12:31:22 PM2/5/13
to stan...@googlegroups.com
This should be ok, so long as the DUMMY_VARI_PTR__ adjoint value is set somewhere else during the gradient calculation or DUMMY_VAR__ is never used.  That said, I'm not sure what you guys are doing so... :)

Cheers,
Marcus


--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages