Suppose I have a torch CUDA tensor and I want to apply some function like sin()
but I have explicitly defined the function F
. How can I use parallel computation to apply F
in Pytorch.
torch.cuda. synchronize (device=None)[source] Waits for all kernels in all streams on a CUDA device to complete.
cuda. is_available. Returns a bool indicating if CUDA is currently available.
I think currently, it is not possible to explicit parallelize a function on a CUDA-Tensor. A possible solution could be, you can define a Function like the for example the non-linear activation functions. So you can feed forward it through the Net and your function.
The drawback is, it probably don't work, because you have to define a CUDA-Function and have to recompile pytorch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With