Array API
まだ誰も着手していません。
評価
調査の方向性
まず、提供された画像処理の例を再現し、報告された145行目付近の _asarray 実装、特に Array._array へのアクセスを調査します。ndarray パスで AttributeError が発生する理由を確認し、done はその例外なしで示された入力を処理できることと定義します。issue ではリポジトリのテストもソースファイルも指定されていません。
索引モデルが issue の本文から書いたものです。
説明
I believe there's an issue with passing in any value to _asarray. The function refuses to create this image's values despite tedious restructuring. I can provide more code and details if you like, but here is the general code implementation below.
filename = "godfather.jpg"
img = mpimg.imread(filename)
img = rgb2gray(img)
plt.imshow(img, cmap='gray')
def flatten_comprehension(matrix):
return [item for row in matrix for item in row]
imgL = flatten_comprehension(img)
image = np.reshape(np.asarray(imgL, dtype=np.float32), (600, 900), copy=True)
gradient_magnitude, gradient_direction = sobel_filters(image)
img when implemented here is just an nparray from .imread, have to do a lot of weird tricks to get around the first error (worked w @syurkevi on this)
here's the error stack trace
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[42], line 11
7 image = np.reshape(np.asarray(imgL, dtype=np.float32), (600, 900), copy=True)
8 # print(image.shape)
9 # print(type(image))
10 # print(image)
---> 11 gradient_magnitude, gradient_direction = sobel_filters(image)
13 # Display the gradient magnitude as an image
14 plt.figure(figsize=(10, 5))
Cell In[40], line 19
16 Ky = np.asarray([[1, 2, 1], [0, 0, 0], [-1, -2, -1]])
18 # Convolve with Kx and Ky using custom convolve2d function
---> 19 Ix = convolve2d(img, Kx)
20 Iy = convolve2d(img, Ky)
22 # Compute gradient magnitude and direction
Cell In[40], line 5
1 def convolve2d(image, kernel):
2 """
3 Apply a 2D convolution operation without padding.
4 """
----> 5 newImg = np.asarray(image, dtype=np.float32)
6 output = np.zeros_like(newImg) # Prepare the output array
...
--> 145 afarray = Array._array if not copy else af.copy_array(Array._array)
146 elif isinstance(obj, list | tuple):
147 afarray = _process_nested_sequence(obj)
AttributeError: type object 'Array' has no attribute '_array'
- 主要言語
- Python
- スター
- 2
- フォーク
- 5
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
arrayfire/arrayfire-py のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
arrayfire/arrayfire-py#39 · コメント 1 件 ·
-
documentation enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
arrayfire/arrayfire-py#34 ·
-
invalid
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
arrayfire/arrayfire-py#33 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
arrayfire/arrayfire-py#21 ·
arrayfire/arrayfire-py の issue をすべて見る
似ている issue
-
Add: hunch オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
DiamondLightSource/dodal#2211 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
openml/openml-python#1749 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
sipyourdrink-ltd/bernstein#6191 ·