arrayfire / arrayfire/arrayfire-python

Return fixed length tuple from array.dims()?

Aperta
#171 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
422
Fork
63
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hi,

Could you consider changing array.dims() to return a fixed length tuple, like (3,4,1,1)? Currently it's necessary to check the length of the returned tuple before indexing it to get the size of a specific dimension.

```
>>> import arrayfire as af
>>> aa = af.randu(3,4,1)
>>> aa.dims()
(3, 4)
>>> bb = af.randu(3,4,2)
>>> bb.dims()
(3, 4, 2)
>>>
```

Something like this...

```
>>> def dims(arr):
>>> return arr.dims() + ((1,)*(4-len(arr.dims())))

>>> dims(aa)
(3,4,1,1)
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start at the Python binding entry point for array.dims() and inspect how it currently exposes ArrayFire dimensions. Use the examples in the issue to confirm the intended four-element behavior and its effect on existing callers. Done means the API consistently returns the requested fixed-length tuple and its behavior is covered by the relevant tests.

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

Valutazione

Stack tecnologico
python
Ambito
api
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.