Skip to content
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

Vectorize make_vector #889

Merged
merged 1 commit into from
Jul 8, 2024
Merged

Conversation

ricardoV94
Copy link
Member

Description

Showed up in some vectorized logps in pymc-devs/pymc-experimental#353

We can always convert a vectorized MakeVector (stack of scalars) into a join (concatenate) of tensors. May just need to explicitly broadcast them first. No good reason not to do it eagerly

Related Issue

Checklist

Type of change

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

Copy link

codecov bot commented Jul 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.21%. Comparing base (5fd729d) to head (7f19764).
Report is 114 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #889   +/-   ##
=======================================
  Coverage   81.21%   81.21%           
=======================================
  Files         170      170           
  Lines       47020    47028    +8     
  Branches    11523    11525    +2     
=======================================
+ Hits        38188    38196    +8     
  Misses       6621     6621           
  Partials     2211     2211           
Files with missing lines Coverage Δ
pytensor/tensor/basic.py 88.59% <100.00%> (+0.05%) ⬆️

@ricardoV94
Copy link
Member Author

ricardoV94 commented Jul 6, 2024

I should test it doesn't fail when all inputs are still scalars

new_out = join(
-1, *[expand_dims(batch_inputs, axis=-1) for batch_inputs in batch_inputs]
)
return new_out.owner
Copy link
Member

Choose a reason for hiding this comment

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

why .owner here?

Copy link
Member Author

Choose a reason for hiding this comment

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

vectorize_node returns a node. No idea why, could probably have made it like rewrites and return the output variables

Copy link
Member

Choose a reason for hiding this comment

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

I guess it's right there in the name eh?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's silly and potentially too restrictive, opened an issue: #902

@ricardoV94 ricardoV94 merged commit 7f623fe into pymc-devs:main Jul 8, 2024
59 checks passed
@ricardoV94 ricardoV94 deleted the vectorize_make_vector branch July 8, 2024 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request vectorization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants