Skip to content

Division by zero not guarded in Tensor.__truediv__ backward pass #37

Description

@github-actions

File: leanpass/tensor.py

The backward implementation computes -out.grad * self.data / (other.data ** 2). If other.data contains zeros, this yields infinities or crashes. NumPy will raise a runtime warning and propagate inf values.

Fix: add a small epsilon to the denominator or raise a clear error when dividing by a tensor that may contain zeros.

Label: bug

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions