Skip to content

Fix vacuous reset_parameters tests - #377

Merged
ffl096 merged 1 commit into
mainfrom
frantzen/fix-reset-parameters-tests
Aug 24, 2026
Merged

Fix vacuous reset_parameters tests#377
ffl096 merged 1 commit into
mainfrom
frantzen/fix-reset-parameters-tests

Conversation

@ffl096

@ffl096 ffl096 commented Aug 24, 2026

Copy link
Copy Markdown
Member

The reset_parameters tests of HSNLayer, SCConvLayer and SCN2Layer only asserted on torch.nn.Conv2d modules, which these layers do not contain, so the loop body never executed and the tests passed without checking anything. The zeros comparison would have been wrong regardless, since the layers initialize with Xavier schemes.

Fill all parameters with a sentinel value, reset, and assert that every parameter changed and remains finite.

Fixes #140

The reset_parameters tests of HSNLayer, SCConvLayer and SCN2Layer only
asserted on torch.nn.Conv2d modules, which these layers do not contain,
so the loop body never executed and the tests passed without checking
anything. The zeros comparison would have been wrong regardless, since
the layers initialize with Xavier schemes.

Fill all parameters with a sentinel value, reset, and assert that every
parameter changed and remains finite.

Fixes #140
@ffl096 ffl096 added this to the 0.1.0 milestone Aug 24, 2026
@ffl096 ffl096 self-assigned this Aug 24, 2026
@ffl096 ffl096 added the bug Something isn't working label Aug 24, 2026
@ffl096
ffl096 requested a lite review from Copilot August 24, 2026 12:43
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.36%. Comparing base (aed06d6) to head (7ef7e15).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #377      +/-   ##
==========================================
- Coverage   96.43%   96.36%   -0.08%     
==========================================
  Files          58       58              
  Lines        2078     2090      +12     
==========================================
+ Hits         2004     2014      +10     
- Misses         74       76       +2     

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes vacuous reset_parameters unit tests for several simplicial layers by replacing an incorrect torch.nn.Conv2d-based assertion (which never ran) with a sentinel-based approach that verifies parameters are actually reinitialized.

Changes:

  • Fill all layer parameters with a sentinel value under torch.no_grad().
  • Call reset_parameters() and assert each parameter is finite.
  • Assert each parameter tensor is no longer entirely equal to the sentinel value.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
test/nn/simplicial/test_scn2_layer.py Makes reset_parameters test non-vacuous by sentinel-filling parameters and verifying they change and remain finite.
test/nn/simplicial/test_scconv_layer.py Same sentinel-based validation for SCConvLayer.reset_parameters().
test/nn/simplicial/test_hsn_layer.py Same sentinel-based validation for HSNLayer.reset_parameters().

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ffl096
ffl096 merged commit 676d697 into main Aug 24, 2026
38 of 39 checks passed
@ffl096
ffl096 deleted the frantzen/fix-reset-parameters-tests branch August 24, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem with test_reset_parameters() in test_hsn_layer.py

2 participants