Skip to content

Tensor.log lacks input validation for non‑positive values #32

Description

@github-actions

File: leanpass/tensor.py

Calling log() on a tensor containing zero or negative numbers produces -inf or nan without warning, and the backward pass will propagate these invalid values. Standard autograd libraries either raise an error or clamp the input to a small epsilon for numerical stability.

Fix: add a check that all elements are > 0 (or >= epsilon) and raise a ValueError or clamp the data before applying np.log.

Label: bug (numerical stability).

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