Skip to content

Add zero, constant, reflection and replication padding layers - #103

Merged
jessegrabowski merged 2 commits into
pymc-devs:mainfrom
jessegrabowski:padding-layers
Aug 23, 2026
Merged

Add zero, constant, reflection and replication padding layers#103
jessegrabowski merged 2 commits into
pymc-devs:mainfrom
jessegrabowski:padding-layers

Conversation

@jessegrabowski

Copy link
Copy Markdown
Member

Standalone padding layers, for the cases where the padding and the convolution want separate control. pt.pad already does the work, so these are mostly an argument surface over _pad_spatial — which moved out of the conv module on the way, since padding isn't convolution.

Two deliberate differences from torch. Padding is one entry per axis in input order, ((top, bottom), (left, right)), rather than torch's flat last-axis-first sequence; axis order is what the rest of the library already uses, and a flat 4-tuple gets an error saying so. And a reflection wider than the axis folds back and forth like numpy's, where torch refuses.

Part of #2.

@codecov-commenter

codecov-commenter commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.70330% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.47%. Comparing base (31666a4) to head (018e2fb).

Files with missing lines Patch % Lines
pytensor_ml/layers/padding.py 96.15% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #103      +/-   ##
==========================================
- Coverage   97.51%   97.47%   -0.04%     
==========================================
  Files          59       60       +1     
  Lines        2938     3011      +73     
==========================================
+ Hits         2865     2935      +70     
- Misses         73       76       +3     

☔ 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.

@jessegrabowski
jessegrabowski merged commit 559cfc8 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