Skip to content

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

if any(
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)

@asifzubair
Copy link
Contributor

Hi @golocule , are you still working on this ? If not, would you mind if I take it over ? Thank you 🙏

@ricardoV94
Copy link
Member

Fixed by #7877

@ricardoV94 ricardoV94 closed this Jul 29, 2025
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

3 participants