Skip to content

Fix Bilinear weight shape in docstring#3770

Closed
Pablosinyores wants to merge 1 commit into
ml-explore:mainfrom
Pablosinyores:fix/bilinear-weight-shape-doc
Closed

Fix Bilinear weight shape in docstring#3770
Pablosinyores wants to merge 1 commit into
ml-explore:mainfrom
Pablosinyores:fix/bilinear-weight-shape-doc

Conversation

@Pablosinyores

Copy link
Copy Markdown
Contributor

Summary

nn.Bilinear stores its weight as [output_dims, input2_dims, input1_dims] — both __call__ and extra_repr unpack it as out, in2, in1 = self.weight.shape, and the forward computes W[o, in2, in1]. The docstring, however, documented [output_dims, input1_dims, input2_dims], swapping the two input dimensions.

This corrects the docstring to the actual stored order and pins the weight shape in test_bilinear so the documented order stays in sync with the implementation.

Behavior is unchanged (docs + test only).

Checklist

  • I have read the CONTRIBUTING document
  • I have added tests that prove my fix is effective (pins the weight shape)
  • I have run pre-commit/black on my changes

nn.Bilinear stores its weight as [output_dims, input2_dims, input1_dims]
(the __call__ and extra_repr both unpack it that way), but the docstring
documented [output_dims, input1_dims, input2_dims], swapping the two input
dimensions. Correct the docstring and pin the weight shape in test_bilinear
so the documented order stays in sync with the implementation.
@zcbenz

zcbenz commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the PR, this had been fixed by #3758, please let us know if it is missing anything.

@zcbenz zcbenz closed this Jun 27, 2026
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