Skip to content

Advanced sub tensor with none and integers fix #7814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

golocule
Copy link

@golocule golocule commented Jun 9, 2025

Description

Fixed the AdvancedSubTensor with None and Integer values bug of having a logprob error instead of gracefully crashing through including a check for NoneConst types in mixture.py. None is returned if None values are found in a logprob. Added a test in test_mixture.py called test_advanced_subtensor_none_and_integer that validates the bug is fixed through checking there is a runtime error instead of an internal error when a logprob dictionary of integers and None values is attempted to be created.

Related Issue

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

📚 Documentation preview 📚: https://pymc--7814.org.readthedocs.build/en/7814/

Copy link

welcome bot commented Jun 9, 2025

Thank You Banner]
💖 Thanks for opening this pull request! 💖 The PyMC community really appreciates your time and effort to contribute to the project. Please make sure you have read our Contributing Guidelines and filled in our pull request template to the best of your ability.

@github-actions github-actions bot added bug hackathon Suitable for hackathon logprob labels Jun 9, 2025
a_val = a.type()
a_val.name = "a_val"

try:
Copy link
Member

Choose a reason for hiding this comment

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

Use pytest.raises

@@ -292,6 +292,7 @@ def find_measurable_index_mixture(fgraph, node):
indices.dtype.startswith("int") and sum(1 - b for b in indices.type.broadcastable) > 0
for indices in mixing_indices
if not isinstance(indices, SliceConstant)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if not isinstance(indices, SliceConstant)
if not isinstance(indices.type, SliceType | NoneTypeT)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug hackathon Suitable for hackathon logprob
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: AdvancedSubTensor with None and integer indices raises a logprob error instead of silently failing
2 participants