Skip to content

Commit a9ea31e

Browse files
Dobiasdclaude
andcommitted
Add regression test for EinsumDense bias_axes ordering
The four prior EinsumDense test cases all used bias_axes in canonical (rhs-matching) order, so the bias-ordering bug fixed in the previous commit was invisible to the suite. Add an explicit case where bias_axes is permuted ('ed' on rhs='abde'). Verified by temporarily reverting the fix: this case fails the 1e-5 tolerance, confirming the test now catches the regression. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 568321e commit a9ea31e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

keras_export/generate_test_models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,11 @@ def get_test_model_exhaustive() -> Model:
578578
outputs.append(EinsumDense('abcd,cde->abe', output_shape=(None, 5),
579579
bias_axes='e')(EinsumDense('abc,cde->abde',
580580
output_shape=(None, 3, 4))(inputs[49])))
581+
# bias_axes deliberately not in rhs order: Keras still allocates the bias
582+
# in rhs order ('de'), so this regression case ensures fdeep reads the
583+
# right element when bias_axes characters are permuted.
584+
outputs.append(EinsumDense('abc,cde->abde', output_shape=(None, 3, 4),
585+
bias_axes='ed')(inputs[49]))
581586

582587
# AdaptiveAvg/MaxPooling 1D/2D/3D variants.
583588
outputs.append(AdaptiveAveragePooling1D(output_size=3)(inputs[49]))

0 commit comments

Comments
 (0)