Skip to content

feat: add minimalrnn cell - #55

Merged
MartinuzziFrancesco merged 3 commits into
mainfrom
feat/minimalrnn-cell
Sep 20, 2026
Merged

MartinuzziFrancesco merged 3 commits into
mainfrom
feat/minimalrnn-cell

Conversation

@MartinuzziFrancesco

Copy link
Copy Markdown
Owner

No description provided.

MartinuzziFrancesco and others added 3 commits September 20, 2026 10:00
Ports MinimalRNN (Chen et al. 2017, arXiv:1711.06788), found missing by
diffing against the sister Julia libraries RecurrentLayers.jl and
LuxRecurrentLayers.jl. Follows the MGUCell/MGU pattern, exported from
both package entry points, with tests and docs added.

Also fixes a pre-existing E402 import-order lint error in
tests/test_cells.py, surfaced now that the local pre-commit ruff hook
runs successfully for the first time on this machine.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Two repo-wide issues surfaced by the Codex audit on the MinimalRNN PR,
fixed here per follow-up request:

- base.py's _cleanup_non_scriptable() deleted init_cfg right after
  __init__ used it once, so cell.reset_parameters() raised
  AttributeError if called again after construction, on every cell in
  the library. init_cfg (a Dict[str, str]) is TorchScript-compatible,
  so it's now kept. Added a parametrized regression test over
  CELL_CASES.

- Every layer's docstring (RNN-style multi-timestep classes) claimed
  support for 2D unbatched input and PackedSequence input that
  RecurrentLayerBase.forward never implemented (it unconditionally
  unpacks a 3D tensor). Corrected the Inputs/Outputs sections across
  all affected cells to describe only the 3D batch_first-aware shapes
  that are actually supported, and removed the now-inapplicable
  ``batch_first`` "ignored for unbatched inputs" note. No behavior
  change; single-timestep Cell classes were unaffected since they
  already correctly document 1D/2D support.

Touching these files also pulled in some pre-existing, unrelated
formatting/lint debt (long import lines, unused imports, one
ambiguous variable name) that the repo's pre-commit hooks had
apparently never actually been run against locally; fixed those
incidentally via black/ruff --fix plus one manual rename.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@MartinuzziFrancesco MartinuzziFrancesco changed the title Feat/minimalrnn cell feat: add minimalrnn cell Sep 20, 2026
@codecov-commenter

codecov-commenter commented Sep 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.11321% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.18%. Comparing base (9cdb6d6) to head (47ea8e8).

Files with missing lines Patch % Lines
torchrecurrent/cells/miru_cell.py 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #55      +/-   ##
==========================================
+ Coverage   95.10%   95.18%   +0.08%     
==========================================
  Files          42       43       +1     
  Lines        2573     2619      +46     
==========================================
+ Hits         2447     2493      +46     
  Misses        126      126              

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

@MartinuzziFrancesco
MartinuzziFrancesco merged commit d0c5ffc into main Sep 20, 2026
20 checks passed
@MartinuzziFrancesco
MartinuzziFrancesco deleted the feat/minimalrnn-cell branch September 20, 2026 08:49
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