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
While locally running tests, a bug was surfaced by a recently added validity check (see #4214 (comment)) from Theano-PyMC:
________________________________________________________________TestSamplePPC.test_model_shared_variable_________________________________________________________________self=<pymc3.tests.test_sampling.TestSamplePPCobjectat0x000001EF2100D748>deftest_model_shared_variable(self):
x=np.random.randn(100)
y=x>0x_shared=theano.shared(x)
y_shared=theano.shared(y)
withpm.Model() asmodel:
coeff=pm.Normal("x", mu=0, sd=1)
logistic=pm.Deterministic("p", pm.math.sigmoid(coeff*x_shared))
>obs=pm.Bernoulli("obs", p=logistic, observed=y_shared)
pymc3\tests\test_sampling.py:572:
______________________________________________________________________________________pymc3\distributions\distribution.py:98: in__new__returnmodel.Var(name, dist, data, total_size, dims=dims)
pymc3\model.py:1166: inVarmodel=self,
pymc3\model.py:1800: in__init__self.tag.test_value=theano.compile.view_op(data).tag.test_value
..\theano-pymc\theano\gof\utils.py:277: in__setattr__obj=self.attr_filter(obj)
______________________________________________________________________________________self=TensorType(bool, vector)
data=array([1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0,
1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1,...0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1,
1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1], dtype=int64)
strict=False, allow_downcast=Nonedeffilter(self, data, strict=False, allow_downcast=None):
""" Convert `data` to something which can be associated to a `TensorVariable`. This function is not meant to be called in user code. It is for `Linker` instances to use when running a compiled graph. """# Explicit error message when one accidentally uses a Variable as# input (typical mistake, especially with shared variables).ifisinstance(data, Variable):
raiseTypeError(
"Expected an array-like object, but found a Variable: ""maybe you are trying to call a function on a (possibly ""shared) variable instead of a numeric array?"
)
if (type(data) isnp.ndarray) and (data.dtype==self.numpy_dtype):
ifdata.dtype.num!=self.numpy_dtype.num:
data=theano._asarray(data, dtype=self.dtype)
# -- now fall through to ndim checkelif (type(data) isnp.memmap) and (data.dtype==self.numpy_dtype):
# numpy.memmap is a "safe" subclass of ndarray,# so we can use it wherever we expect a base ndarray.# however, casting it would defeat the purpose of not# loading the whole data into memorypasselifstrict:
# If any of the two conditions above was not met,# we raise a meaningful TypeError.ifnot (type(data) isnp.ndarray):
raiseTypeError(
"%s expected a ndarray object."%self, data, type(data)
)
ifdata.dtype!=self.numpy_dtype:
raiseTypeError(
("%s expected a ndarray object with ""dtype = %s (got %s).")
% (self, self.numpy_dtype, data.dtype)
)
raiseAssertionError("This point should never be reached.")
else:
ifallow_downcast:
# Convert to self.dtype, regardless of the type of datadata=theano._asarray(data, dtype=self.dtype)
# TODO: consider to pad shape with ones to make it consistent# with self.broadcastable... like vector->row type thingelse:
ifisinstance(data, np.ndarray):
# Check if self.dtype can accurately represent data# (do not try to convert the data)up_dtype=scal.upcast(self.dtype, data.dtype)
ifup_dtype==self.dtype:
# Bug in the following line when data is a# scalar array, see# http://projects.scipy.org/numpy/ticket/1611# data = data.astype(self.dtype)data=theano._asarray(data, dtype=self.dtype)
ifup_dtype!=self.dtype:
err_msg= (
"%s cannot store a value of dtype %s without ""risking loss of precision. If you do not mind ""this loss, you can: ""1) explicitly cast your data to %s, or "'2) set "allow_input_downcast=True" when calling ''"function". Value: "%s"'% (self, data.dtype, self.dtype, repr(data))
)
>raiseTypeError(err_msg)
ETypeError: TensorType(bool, vector) cannotstoreavalueofdtypeint64withoutriskinglossofprecision. Ifyoudonotmindthisloss, youcan: 1) explicitlycastyourdatatobool, or2) set"allow_input_downcast=True"whencalling"function". Value: "array([1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0,
E1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0,
E0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0,
E1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1,
E1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1], dtype=int64)"
..\theano-pymc\theano\tensor\type.py:145: TypeError
The problem does not surface in CI pipelines, because they don't test against latest Theano-PyMC !
Versions and main components
PyMC3 Version: recent master
Theano Version: recent Theano-PyMC master
The text was updated successfully, but these errors were encountered:
Description of your problem
While locally running tests, a bug was surfaced by a recently added validity check (see #4214 (comment)) from Theano-PyMC:
The problem does not surface in CI pipelines, because they don't test against latest Theano-PyMC !
Versions and main components
The text was updated successfully, but these errors were encountered: