File: leanpass/tensor.py
Calling log() on a tensor containing zeros or negative numbers yields -inf or nan without any warning, which propagates through the graph and makes training unstable. The implementation should either raise a clear error for invalid inputs or clamp the values to a small positive epsilon before applying np.log.
def log(self):
- out = self._create_child(np.log(self.data), "log", {self})
+ if np.any(self.data <= 0):
+ raise ValueError("log() received non‑positive values")
+ out = self._create_child(np.log(self.data), "log", {self})
Filed automatically by ai-issue-scan.
File:
leanpass/tensor.pyCalling
log()on a tensor containing zeros or negative numbers yields-infornanwithout any warning, which propagates through the graph and makes training unstable. The implementation should either raise a clear error for invalid inputs or clamp the values to a small positive epsilon before applyingnp.log.Filed automatically by ai-issue-scan.