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

Feature request: safety factor parameter

Aperta
#135 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python, pytorch
Ambito
testing

Direzione di ricerca

Inizia leggendo l’helper Ivy collegato in ivy_tests/test_ivy/helpers.py intorno alla riga 1793 e verifica come vengono generati i valori limite per il remainder case. Chiarisci con i maintainer l’API e l’ambito desiderati del safety factor; il completamento dovrebbe includere il comportamento documentato e una copertura che dimostri che i valori generati evitano i limiti rappresentabili oppure li includono intenzionalmente.

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

Descrizione

We (at Ivy) have observed that small variations in how different frameworks handle values very close to the borders of the representable limits of data types can lead to failing tests in the Array API test suite. These errors can be hard to handle, and can result from something as simple as a small rounding error which pushes things over the representable limits for one framework but not another one. For example, with remainder in PyTorch:

# Data generated in `test_remainder`:
x1 = tensor([[ 0.0000e+00, 2.1132e+270,  0.0000e+00,  0.0000e+00],
        [ 0.0000e+00,  0.0000e+00,  0.0000e+00,  0.0000e+00]],
       dtype=torch.float64) 
x2 = ivy.array(1.1754944e-38, dtype=ivy.float32)

# Result for PyTorch:
tensor([[0., nan, 0., 0.],
        [0., 0., 0., 0.]], dtype=torch.float64)

i.e. remainder(2.1132e+270, 1.1754944e-38) = nan when it should return 0. We think there has been some rounding of 1.1754944e-38 to 0 which results in the nan as this number is at the 'tiny' limit of float32:

finfo(resolution=1e-06, min=-3.40282e+38, max=3.40282e+38, eps=1.19209e-07, tiny=1.17549e-38, dtype=float32)

Therefore, it would be useful if there was a safety_factor parameter, or something similar, which prevents values from being generated which are right at the limits of the data type. For example, if values are only generated up to 95% of the maximum size (either on a linear or log scale), then this makes it possible the define the importance of such rigorous testing. Such an approach makes it possible Ivy tests to use hypothesis without needing to solve hundreds too many rare corner cases (example).

Let me know what you think 😊

Lingua principale
Python
Stelle
74
Fork
54
Merge medio
4h 35m
PR unite (30g)
4

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 data-apis/array-api-tests

Tutte le issue di data-apis/array-api-tests

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.