Closed fanshi118 closed 3 years ago
I was able to reproduce the error locally by rerunning the test numerous times with debug mode enabled. To rerun the test, I simply added the following annotation: @pytest.mark.parametrize("x", list(range(1000)))
.
Here are the relevant values:
>>> point
None
>>> size
1
>>> states
np.array([[0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0]], dtype=np.int32)
>>> samples
np.array([[0.e+000, 0.e+000, 5.e-324, 5.e-324, 0.e+000, 5.e-324, 0.e+000,
0.e+000, 0.e+000, 0.e+000, 0.e+000]])
>>> i
1
>>> dist
<pymc3.distributions.discrete.Poisson at 0x7fe758572290>
>>> dist.mu
TensorConstant{100.0}
>>> i_idx
(np.array([0, 0, 0]), np.array([2, 3, 5]))
>>> i_size
3
>>> subset_args
[AdvancedSubtensor.0]
>>> theano.printing.debugprint(subset_args)
AdvancedSubtensor [id A] ''
|Elemwise{mul,no_inplace} [id B] ''
| |InplaceDimShuffle{x,x} [id C] ''
| | |TensorConstant{100.0} [id D]
| |Alloc [id E] ''
| |TensorConstant{1.0} [id F]
| |TensorConstant{1} [id G]
| |TensorConstant{11} [id H]
|TensorConstant{(3,) of 0} [id I]
|TensorConstant{[2 3 5]} [id J]
>>> subset_args[0].eval()
np.array([100., 100., 100.])
It looks like there's an inconsistency appearing here:
>>> dist.dist(subset_args[0].eval()).random()
np.array([ 94, 99, 107])
>>> dist.dist(*subset_args).random()
array([ 7, 3, 12, 18, 8, 14, 15, 12, 4])
~The problem is caused by the _DrawValuesContext
; it contains a value for the TensorVariable
in subset_args[0]
, and that value has the wrong dimensions. This causes Distribution.random
to use that incorrect value somewhere down the line.~
~It looks like we may need to use _DrawValuesContextBlocker
to prevent _DrawValuesContext
from picking up the sampled values of the subset_args
entries.~
This is caused by an issue in pymc3.memoize.memoize
. See https://github.com/pymc-devs/pymc3/issues/4506.
Reinstalled the pymc3
library with the most updated version in the GitHub repo. Ran test_DiscreteMarkovChain_random
locally through 1000 runs (w/ randomized seed values) and didn't encounter this error. Looks like the issue has been fixed. How should we update the pymc3
version? By pointing directly to git+https://github.com/pymc-devs/pymc3
?
We'll have to wait for a new release, but we can close this issue.
Description of your problem or feature request
One of the tests has failed at one run in CI. Doubt if this is a consistent error, which can possibly be fixed by setting a seed for that test?
Please provide a minimal, self-contained, and reproducible example.
Please provide the full traceback of any errors.
Please provide any additional information below.
Versions and main components
python -c "import theano; print(theano.config)"
)