Skip to content

Fix bugs in shape inference #546

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

Merged
merged 2 commits into from
Dec 11, 2023

Conversation

ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Dec 11, 2023

Description

The PyMC CI revealed two bugs in the PyTensor release:

  1. A rewrite that did not handle the shape of scalars correctly introduced in the latest release in Faster infer_static_shape #521
  2. A bug in the shape inference of multivariate RVs when size is not provided and the parameters batch dimensions require broadcasting. This bug was lurking for a long time now.

Related Issue

  • Closes issue: #
  • Related issue (not closed by this PR): #

Checklist

Type of change

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

@ricardoV94 ricardoV94 force-pushed the infer_static_shape_bug branch from 86e163c to e57d2d2 Compare December 11, 2023 16:52
When size is not provided, the batch shapes of the parameters were being broadcasted twice, and the second time, wrongly, due to mixing static shape of the original parameters and the potentially larger shape of the just broadcasted parameters.
@codecov-commenter
Copy link

Codecov Report

Merging #546 (4dbf2e2) into main (2cef9c0) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #546   +/-   ##
=======================================
  Coverage   80.90%   80.90%           
=======================================
  Files         162      162           
  Lines       46415    46416    +1     
  Branches    11353    11354    +1     
=======================================
+ Hits        37553    37554    +1     
  Misses       6639     6639           
  Partials     2223     2223           
Files Coverage Δ
pytensor/tensor/basic.py 88.47% <ø> (ø)
pytensor/tensor/random/op.py 96.22% <100.00%> (-0.05%) ⬇️
pytensor/tensor/rewriting/shape.py 81.53% <100.00%> (+0.10%) ⬆️

@ricardoV94 ricardoV94 merged commit c38eea0 into pymc-devs:main Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants