Reciprocal of elements of a THCudaTensor in cpp?

Hi,

We can use THCudaTensor_div to divide by a real number and THCudaTensor_cdiv to divide 2 tensors.

What is the best way to take reciprocal of elements of a THCudaTensor in a custom C++ extension.

Regards
Nabarun

One way I am thinking of right now is to create another tensor, fill it with ones and use THCudaTensor_cdiv. Wondering if there is any straightforward way to do it. :thinking: