Skip to content

Commit a8e892b

Browse files
committed
GP do not fail when xdims cannot be constant folded
1 parent c8a503c commit a8e892b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pymc/gp/cov.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,15 @@ def n_dims(self) -> int:
180180
"""The dimensionality of the input, as taken from the
181181
`active_dims`.
182182
"""
183-
# Evaluate lazily in-case this changes.
183+
# Evaluate lazily in case this changes.
184184
return len(self.active_dims)
185185

186186
def _slice(self, X, Xs=None):
187187
xdims = X.shape[-1]
188188
if isinstance(xdims, Variable):
189-
[xdims] = constant_fold([xdims])
190-
if self.input_dim != xdims:
189+
[xdims] = constant_fold([xdims], raise_not_constant=False)
190+
# If xdims can't be fully constant folded, it will be a TensorVariable
191+
if isinstance(xdims, int) and self.input_dim != xdims:
191192
warnings.warn(
192193
f"Only {self.input_dim} column(s) out of {xdims} are"
193194
" being used to compute the covariance function. If this"

0 commit comments

Comments
 (0)