arrayfire / arrayfire-python

Python bindings for ArrayFire: A general purpose GPU library.

Home Page:https://arrayfire.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

arrayfire imax function

arilevitas opened this issue · comments

max_val, max_idx = af.imax(img)

running this function seems to have wrong behavior and finds wrong max value for an image with pixels in range [0,1].

When running max_val, max_idx = af.imax(af.flat(img)) the correct max value is found.

I'm having trouble reproducing this with various backends and image sizes.

af.info()
af.set_backend('opencl')
img = af.randu(3,3)
max_val, max_idx = af.imax(img)
max_valf, max_idxf = af.imax(af.flat(img))
print(img)
print(max_val)
print(max_idx)
print(max_valf)
print(max_idxf)
#####
[3 3 1 1]
    0.3688     0.1266     0.4220 
    0.2578     0.6511     0.2491 
    0.3815     0.4507     0.4128 


0.6511174440383911
4
0.6511174440383911
4

This is with the latest wheels. Can you provide more info what system/gpu/release/backend/OS/driver version/python version you're seeing the wrong behavior? Sample data or a minimal reproducible code snippet would be appreciated as well 🙏

image

Let me know if this is helped
arrayfire version: 3.6.20181017

[[0.07369253, 0.06271768, 0.05245196],
[0.08713178, 0.07496584, 0.06345784],
[0.10122371, 0.08787344, 0.07517199]]