Array API
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 30/100
Direzione di ricerca
Inizia riproducendo l’esempio di elaborazione delle immagini fornito e ispeziona l’implementazione di _asarray intorno alla riga 145 indicata, in particolare l’accesso a Array._array. Conferma perché il percorso ndarray solleva AttributeError e definisci done come la gestione dell’input mostrato senza questa eccezione; nell’issue non vengono nominati né un test del repository né un file sorgente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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'
- Lingua principale
- Python
- Stelle
- 2
- Fork
- 5
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di arrayfire/arrayfire-py
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
arrayfire/arrayfire-py#39 · 1 commento ·
-
documentation enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 30/100
arrayfire/arrayfire-py#34 ·
-
invalid
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
arrayfire/arrayfire-py#33 ·
-
Array API Item Assignment Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
arrayfire/arrayfire-py#21 ·
Tutte le issue di arrayfire/arrayfire-py
Issue simili
-
bug ci good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
documentation
Difficoltà 2/5 Mezza giornata Idoneità per principianti 62/100
inmanta/inmanta-core#10835 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
sponsored
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100