arrayfire / arrayfire/arrayfire-python
Return fixed length tuple from array.dims()?
Aberta
- Linguagem predominante
- Python
- Estrelas
- 422
- Forks
- 63
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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)
```
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Avaliação
Esta issue ainda não foi avaliada.