Skip to content

Conversation

ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Jun 20, 2023

This makes more sense as the rest of the codebase prioritizes dimshuffle over other reshape operations, and most rewrites target those.

There is even a rewrite to use expand_dims from reshape when safe.

@ricardoV94 ricardoV94 changed the title Use Dimshuffle for expand_dims and single element make_vector Use Dimshuffle for expand_dims and single element make_vector Jun 20, 2023
@ricardoV94 ricardoV94 force-pushed the use_dimshuffle_instead_of_reshape branch from a2b9083 to 823596b Compare June 20, 2023 15:25
This prevents surprises when passing two scalars, which are interpreted differently in the numpy API
@ricardoV94 ricardoV94 force-pushed the use_dimshuffle_instead_of_reshape branch from 823596b to 8c782ae Compare June 21, 2023 08:32
@ricardoV94 ricardoV94 changed the title Use Dimshuffle for expand_dims and single element make_vector Use Dimshuffle for expand_dims Jun 21, 2023
@ricardoV94 ricardoV94 force-pushed the use_dimshuffle_instead_of_reshape branch from 8c782ae to f0bcab8 Compare June 26, 2023 08:09
@codecov-commenter
Copy link

Codecov Report

Merging #353 (f0bcab8) into main (df4183d) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #353   +/-   ##
=======================================
  Coverage   80.39%   80.40%           
=======================================
  Files         156      156           
  Lines       45397    45400    +3     
  Branches    11106    11104    -2     
=======================================
+ Hits        36497    36502    +5     
+ Misses       6694     6691    -3     
- Partials     2206     2207    +1     
Impacted Files Coverage Δ
pytensor/tensor/var.py 87.57% <ø> (+0.14%) ⬆️
pytensor/tensor/basic.py 90.77% <100.00%> (+0.01%) ⬆️
pytensor/tensor/extra_ops.py 89.00% <100.00%> (+0.01%) ⬆️
pytensor/tensor/math.py 90.49% <100.00%> (ø)
pytensor/tensor/rewriting/elemwise.py 88.90% <100.00%> (ø)
pytensor/tensor/rewriting/subtensor.py 88.73% <100.00%> (ø)
pytensor/tensor/slinalg.py 93.54% <100.00%> (ø)

... and 6 files with indirect coverage changes

@ricardoV94 ricardoV94 merged commit 60bc368 into pymc-devs:main Jun 26, 2023
@ricardoV94 ricardoV94 deleted the use_dimshuffle_instead_of_reshape branch June 26, 2023 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants