Skip to content

Make ConvLayerGrad usable on its own as a transposed convolution - #102

Merged
jessegrabowski merged 6 commits into
pymc-devs:mainfrom
jessegrabowski:conv-transpose-grad
Aug 23, 2026
Merged

Make ConvLayerGrad usable on its own as a transposed convolution#102
jessegrabowski merged 6 commits into
pymc-devs:mainfrom
jessegrabowski:conv-transpose-grad

Conversation

@jessegrabowski

Copy link
Copy Markdown
Member

A transposed convolution is the input gradient of a forward one, so ConvLayerGrad already computes it. Using it that way didn't work: it always computed the kernel gradient too, and differentiating it hit OpFromGraph's default pullback, which builds an anonymous op only numba can run.

It now returns either gradient alone, a rewrite drops whichever has no clients, and its own pullback is written as ConvLayer and one-sided ConvLayerGrad calls so every backend dispatches it. The ConvTranspose layers come next.

@codecov-commenter

codecov-commenter commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.28571% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.51%. Comparing base (e867086) to head (a8b3bca).

Files with missing lines Patch % Lines
pytensor_ml/dispatch/pytorch/conv.py 47.82% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #102      +/-   ##
==========================================
- Coverage   97.89%   97.51%   -0.39%     
==========================================
  Files          59       59              
  Lines        2856     2938      +82     
==========================================
+ Hits         2796     2865      +69     
- Misses         60       73      +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

Inductor could not resolve shapes through the nested autograd tape the previous form built, failing the transposed-convolution gradient test with `cannot determine truth value of Relational`.
@jessegrabowski
jessegrabowski merged commit 31666a4 into pymc-devs:main Aug 23, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants