File: leanpass/tensor.py
The division operator implements self.data / other.data and the backward pass uses other.data ** 2. If other.data contains zeros, NumPy will emit inf/nan and gradients become undefined. Typical autograd libraries raise an error or return a large finite gradient.
Fix: Add a small epsilon to the denominator (e.g., den = other.data + eps) and use the same epsilon in the backward computation, or explicitly check for zeros and raise a clear exception.
File: leanpass/tensor.py
Filed automatically by ai-issue-scan.
File:
leanpass/tensor.pyThe division operator implements
self.data / other.dataand the backward pass usesother.data ** 2. Ifother.datacontains zeros, NumPy will emitinf/nanand gradients become undefined. Typical autograd libraries raise an error or return a large finite gradient.Fix: Add a small epsilon to the denominator (e.g.,
den = other.data + eps) and use the same epsilon in the backward computation, or explicitly check for zeros and raise a clear exception.File:
leanpass/tensor.pyFiled automatically by ai-issue-scan.