arrayfire / arrayfire/arrayfire-python
Return fixed length tuple from array.dims()?
- Lenguaje dominante
- Python
- Estrellas
- 422
- Forks
- 63
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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)
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- api
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100