Skip to content

Missing stability guard in Tensor.log (and related ops) #45

Description

@github-actions

File: leanpass/tensor.py

Tensor.log directly calls np.log(self.data) without checking for non‑positive inputs. Passing zero or negative values yields -inf or nan, propagating invalid gradients. Adding a small epsilon (e.g., np.log(np.clip(self.data, eps, None))) or raising a clear error would make the operation safer and align with typical autodiff expectations.

Filed automatically by ai-issue-scan.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions