Fold the receptive field into the Xavier fans - #77
Merged
jessegrabowski merged 3 commits intoAug 10, 2026
Conversation
Passing a Generator to `shared` already returns a RandomGeneratorSharedVariable, so this changes which constructor is written rather than what is built.
Summing the shape is the fan computation only for a matrix, so a 3x3 kernel came out around 2.7x too wide; the leading dimension is the fan-in here, matching this library's (n_in, n_out) layout rather than torch's transpose of it.
examples/mnist_feed_forward.ipynb imports both and neither was listed anywhere, so the tracked example could not be run from a declared install.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #77 +/- ##
==========================================
+ Coverage 95.42% 95.43% +0.01%
==========================================
Files 45 45
Lines 1792 1798 +6
==========================================
+ Hits 1710 1716 +6
Misses 82 82 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sqrt(2 / sum(shape))is the right fan computation only for a matrix, so a conv kernel came out about 2.7x too wide, and a 1-D parameter got a number with no meaning behind it — that now raises. Nothing in the tree has a 4-D weight yet, so this lands ahead of the conv work rather than fixing anything shipping, and every existing 2-D parameter draws bit-identically since the fan sum is the shape sum there. Fan-in is the leading dimension, matchingLinear's(n_in, n_out)rather than torch's transpose of it — invisible to Xavier, load-bearing for anything that scales by fan-in alone.Two unrelated riders:
Dropoutbuilds its generators with pytensor'sshared_rng, and the tracked mnist notebook's matplotlib and tqdm are declared.