Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use arrayfire function #30

Closed
huibinchang opened this issue May 30, 2018 · 5 comments
Closed

Use arrayfire function #30

huibinchang opened this issue May 30, 2018 · 5 comments

Comments

@huibinchang
Copy link

huibinchang commented May 30, 2018

Hi, Filipe. I want to know how to use the arrayfire function as arrayfire.matmul for matrix multiplication and other functions in arrayfire.linalg. Does it exist a easy way for this?
I tried to use af.arrayfire.matmul. However, it failed since it can not recognize the data type. To run the code, I have to copy the data from GPU to CPU, and then use numpy function instead of afnumpy.

Thanks.

@FilipeMaia
Copy link
Owner

Hi,

This is kinda of a hack but you can do it like this:

a = afnumpy.ones((3,3))
b = afnumpy.array(afnumpy.arrayfire.matmul(a.d_array, a.d_array))

@huibinchang
Copy link
Author

Thanks for your quick response. I will have a try!

By the way, afnumpy is really efficient for me (Only use Matlab before).

Huibin

@FilipeMaia
Copy link
Owner

Thanks!

@FilipeMaia
Copy link
Owner

BTW in the latest afnumpy afnumpy.dot does matrix multiplication when given 2D arrays as input, just like regular numpy.

@huibinchang
Copy link
Author

huibinchang commented Jun 1, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants