arrayfire / arrayfire/arrayfire-python

Return fixed length tuple from array.dims()?

Aberta
#171 1 comentário 0 reações 0 responsáveis Ver no GitHub
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.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.