arrayfire / arrayfire/arrayfire-python

Return fixed length tuple from array.dims()?

未關閉
#171 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
422
分支
63
PR 合併指標
30 天內沒有已合併 PR

描述

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)
```

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

從 array.dims() 的 Python 綁定進入點開始,檢查它目前如何公開 ArrayFire 維度。使用 issue 中的範例確認預期的四元素行為及其對現有呼叫端的影響。當 API 始終回傳所要求的固定長度 tuple,且其行為已由相關測試涵蓋時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
api
Issue 類型
功能
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。