Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Unnecessary Tensor allocation in `Dropout` forward pass

Open Beginner friendly
#65 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
numpy, python

Research direction

Start in leanpass/nn.py and read Dropout.forward to see how the mask is created and used. Check the existing tests or run the relevant test suite to verify dropout behavior before and after the change. Done when the forward pass avoids an unnecessary gradient-tracking Tensor for the mask and dropout behavior remains correct.

Written by the indexing model from the issue text.

Description

performance

File: leanpass/nn.py

Dropout.forward creates a new Tensor for the dropout mask on every call (Tensor(mask)). The mask never requires gradients, so wrapping it in a Tensor adds overhead (extra object, backward node) without benefit. Use the raw NumPy mask directly in the multiplication (x * mask) or create a non‑gradient‑tracking Tensor once and reuse it. This reduces memory churn during training.

Filed automatically by ai-issue-scan.

Dominant language
Python
Stars
16
Forks
1
Avg merge
2d 8h
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Terminay/leanpass

All issues in Terminay/leanpass

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.