Skip to content

Linear layer does not validate in_features and out_features arguments #34

Description

@github-actions

File: leanpass/nn.py

If a user passes non‑positive integers (e.g., in_features=0 or negative values), the weight initialization scale = 1.0 / np.sqrt(in_features) will raise a ZeroDivisionError or produce nan values. Libraries usually validate layer dimensions and raise a clear ValueError.

Fix: add checks in Linear.__init__ to ensure both dimensions are positive integers and raise an informative exception otherwise.

Label: bug (edge‑case handling).

Filed automatically by ai-issue-scan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions