Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Division by zero raises exception even when NumPy could handle it

Aperta
#59 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
numpy, python

Direzione di ricerca

Start by reading leanpass/tensor.py, focusing on Tensor.__truediv__ and its current zero check. Decide which division-by-zero behavior is intended—NumPy’s inf/nan results or an epsilon-based approach—and document that choice. Done means division follows the chosen behavior instead of raising the current hard error.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

File: leanpass/tensor.py

Tensor.__truediv__ checks np.any(other.data == 0) and raises ZeroDivisionError. NumPy already defines IEEE‑754 behavior (inf, -inf, nan) for element‑wise division, and many models rely on that. Raising an exception prevents legitimate use‑cases (e.g., masking with zero). Replace the hard error with a guarded operation that either returns inf/nan or adds a small epsilon, and document the chosen behavior.

Filed automatically by ai-issue-scan.

Lingua principale
Python
Stelle
16
Fork
1
Merge medio
2g 8h
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Terminay/leanpass

Tutte le issue di Terminay/leanpass

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.