andersbll / cudarray

CUDA-based NumPy
MIT License
234 stars 61 forks source link

Update math.py to include tanh elementwise op #14

Open Henry-Chinner opened 9 years ago

Henry-Chinner commented 9 years ago

This was my first pull request ever, so hope I did it right :) . I added a tanh elementwise function. It seemed to be missing and intended to be included as there is a tanh_d.

andersbll commented 9 years ago

Hey, thank you for the proposal! I have intentionally left out cudarray.nnet.tanh() because NumPy exposes it at the root level. Therefore, you can find it as cudarray.tanh(). The implementation is here.

Best, Anders

Henry-Chinner commented 9 years ago

Ah great, Thanks Anders.

While on the subject, are elementwise operations executed on the CPU or GPU. I did some monitoring and it seems like elementwise operations are performed on the CPU.

Henry,

andersbll commented 9 years ago

Hey, I have just pushed a commit. In this new version of CUDArray you can check the backend by printing cudarray._backend. If this variable is 'numpy' instead of 'cuda', something is wrong with your libcudarray installation.