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

Add Pytorch implementation of Blockwise #988

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

Ch0ronomato
Copy link
Contributor

@Ch0ronomato Ch0ronomato commented Sep 8, 2024

Description

Adds the blockwise operator for torch (using torch.vmap), and adds a test.

Related Issue

Checklist

Type of change

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

Copy link
Member

@ricardoV94 ricardoV94 left a comment

Choose a reason for hiding this comment

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

Looks like a good start. Can we split Cholesky and Solve into a separate PR from Blockwise though? They are conceptually distinct

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.10%. Comparing base (e655429) to head (9b6555f).
Report is 93 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #988   +/-   ##
=======================================
  Coverage   82.09%   82.10%           
=======================================
  Files         182      183    +1     
  Lines       47901    47924   +23     
  Branches     8631     8632    +1     
=======================================
+ Hits        39325    39348   +23     
  Misses       6410     6410           
  Partials     2166     2166           
Files with missing lines Coverage Δ
pytensor/link/pytorch/dispatch/__init__.py 100.00% <100.00%> (ø)
pytensor/link/pytorch/dispatch/blockwise.py 100.00% <100.00%> (ø)

@Ch0ronomato Ch0ronomato changed the title Add Pytorch Blockwise and Cholesky Add Pytorch Blockwise Oct 20, 2024
batched_dims = op.batch_ndim(node)
core_node = op._create_dummy_core_node(node.inputs)
core_fgraph = FunctionGraph(inputs=core_node.inputs, outputs=core_node.outputs)
inner_func = pytorch_funcify(core_fgraph, squeeze_output=len(node.outputs) == 1)
Copy link
Member

Choose a reason for hiding this comment

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

squeeze_output always works no?

Copy link
Member

@ricardoV94 ricardoV94 left a comment

Choose a reason for hiding this comment

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

Looks good, not sure what you meant with your own comment.

@ricardoV94
Copy link
Member

ricardoV94 commented Nov 3, 2024

Can you squash the commits so this PR has two commits only: 1) Blockwise pytorch and 2) increasing the tolerance of the flaky pre-existing test.

@Ch0ronomato Ch0ronomato force-pushed the blockwise branch 2 times, most recently from b3998a2 to cb7dbdb Compare November 5, 2024 02:20
@ricardoV94 ricardoV94 changed the title Add Pytorch Blockwise Add Pytorch implementation of Blockwise Nov 5, 2024
@ricardoV94 ricardoV94 merged commit a570dbf into pymc-devs:main Nov 5, 2024
62 checks passed
@ricardoV94
Copy link
Member

Thanks @Ch0ronomato !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request torch PyTorch backend vectorization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants