Skip to content

Conversation

ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Jul 17, 2025

Numpy does not support reshape(-1, ...) when size is zero


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

@ricardoV94 ricardoV94 added bug trace-backend Traces and ArviZ stuff labels Jul 17, 2025
@ricardoV94 ricardoV94 changed the title Do not fail with zero-sized arrays in dataset_to_point_list Do not fail with zero-sized arrays in dataset_to_point_list Jul 17, 2025
Numpy does not support reshape(-1, ...) when size is zero
@ricardoV94 ricardoV94 requested a review from OriolAbril July 17, 2025 14:37
Copy link

codecov bot commented Jul 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.98%. Comparing base (8a436d8) to head (5ecc420).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7856      +/-   ##
==========================================
+ Coverage   89.25%   92.98%   +3.73%     
==========================================
  Files         108      108              
  Lines       18327    18328       +1     
==========================================
+ Hits        16358    17043     +685     
+ Misses       1969     1285     -684     
Files with missing lines Coverage Δ
pymc/backends/arviz.py 95.79% <100.00%> (+0.01%) ⬆️

... and 21 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

num_sample_dims = len(sample_dims)
stacked_dims = {dim_name: ds[var_names[0]][dim_name] for dim_name in sample_dims}
transposed_dict = {vn: da.transpose(*sample_dims, ...) for vn, da in ds.items()}
stacked_size = np.prod(transposed_dict[var_names[0]].shape[:num_sample_dims], dtype=int)
Copy link
Member

Choose a reason for hiding this comment

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

should be the same as

stacked_size = np.prod([ds.sizes[dim] for dim in sample_dims], dtype=int)

feel free to choose whichever you prefer

Copy link
Member Author

Choose a reason for hiding this comment

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

ds may be a dict

@ricardoV94 ricardoV94 merged commit f34eb26 into pymc-devs:main Jul 17, 2025
40 of 42 checks passed
@ricardoV94 ricardoV94 deleted the zero_size_dataset branch July 17, 2025 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug trace-backend Traces and ArviZ stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants