pymc_marketing.prior.handle_dims
does not raise an Error when dims
has undesired dimensions
#1248
Labels
pymc_marketing.prior.handle_dims
does not raise an Error when dims
has undesired dimensions
#1248
I came across this issue when I made a mistake writing a transformer's dimensions. I had set the parameter dimensions to one sequence, but I had a typo in one of the transformer's dimensions. This raised an obscure error when trying to run inference or sample from the model's prior predictive. Here's the minimal reproducible example that produces this error:
Note that the
desired_dims
has a dimension called"B"
instead of"b"
.handle_dims
completely ignores the fact that a dimension called"b"
exists, and tries to soldier through.The debug print gives this
where the
DimShuffle
Op is trying to add a new dimension of shape 1 at the end ofx
while dropping the existing dimension. If we actually try toeval
the resulting tensor, we get an error:If the underlying tensor had static shape information, the error would have been picked up immediately:
Summary
handle_dims
ignored the existence of dimensions indims
that were not included indesired_dims
, leading to hard to identify errors creeping up much later in the workflow. We should add a check to verify that thedesired_dims
set includes the supplied set ofdims
.The text was updated successfully, but these errors were encountered: