Fix for #3210 without computing the Bayes network #3273
Fix for #3210 which uses a completely different approach than PR #3214. It uses a context manager inside
It is partly inspired by how Edward2 approaches the problem of forward sampling. Ed2 tensors fix a
The original implementation of
… It uses a context manager inside `draw_values` that makes all the values drawn from `TensorVariables` or `MultiObservedRV`s available to nested calls of the original call to `draw_values`. It is partly inspired by how Edward2 approaches the problem of forward sampling. Ed2 tensors fix a `_values` attribute after they first call `sample` and then only return that. They can do it because of their functional scheme, where the entire graph is recreated each time the generative function is called. Our object oriented paradigm cannot set a fixed _values, it has to know it is in the context of a single `draw_values` call. That is why I opted for context managers to store the drawn values.
…ultivariate distributions that make many calls to draw_values or other distributions random methods within their own random.