Skip to content

Conversation

ricardoV94
Copy link
Member

Description

Subtle bug showed up in pymc-devs/pymc#7370 where a RandomVariable had a wrong signature

Copy link
Member

@jessegrabowski jessegrabowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously the original author assumed these could never be different length (and I see why he thought so). Judging by the test, the errors comes from not enough arguments being passed to RV. Is there no way to directly check that? The error generated by the zip would not give much guidance to how to debug the issue relative to something like f"NormalRV expected 2 inputs, got {len(inputs): {", ".join([str(x) for x in inputs])"

@ricardoV94
Copy link
Member Author

Is there no way to directly check that?

There is but I was hoping my lazy fix would fly under the radar. Well it did not :D

@jessegrabowski
Copy link
Member

jessegrabowski commented Jun 24, 2024

Even if you add a more specific input check, zip should probably still be strict as a last line of defense. So the lazy solution is not implemented in vein!

@ricardoV94
Copy link
Member Author

Even if you add a more specific input check, zip should probably still be strict as a last line of defense. So the lazy solution is not implemented in vein!

That gives me little solace but thank you :D. Mondays are the worst

@Armavica
Copy link
Member

Are we interested in a PR making all the zips strict (or explicitly non-strict)? It's a ruff rule that is not enabled for PyTensor: https://docs.astral.sh/ruff/rules/zip-without-explicit-strict/

@ricardoV94
Copy link
Member Author

Are we interested in a PR making all the zips strict (or explicitly non-strict)? It's a ruff rule that is not enabled for PyTensor: https://docs.astral.sh/ruff/rules/zip-without-explicit-strict/

Maybe, do you like it?

@Armavica
Copy link
Member

Maybe, do you like it?

No, I love it

@ricardoV94
Copy link
Member Author

ricardoV94 commented Jul 8, 2024

Closing in favor of #850

@ricardoV94 ricardoV94 closed this Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants