THTensor_(rawInit)

I can’t figure out how this gets translated to a routine in the tensor library.

a line like:
THTensor *self = THAlloc(sizeof(THTensor));
becomes:
THDoubleTensor *self = THAlloc(sizeof(THDoubleTensor));

and I can find routines like: THDoubleTensor_newWithSize in the tensor library

I would expect this line:
THTensor_(rawInit)(self);

to result in a routine like THDoubleTensor_rawInit,
but I can’t find this name in the library.

Thanks.

The library itself is generated with this same trick, so you can find THTensor_(rawInit) definition for all types here in the generic folder of TH.

right, i see the definition in the c code,
but i can’t find it in the library (mac os in my case)

e.g.

nm -g libAten.dylib| grep THDoubleTensor_newWithSize
000000000016e4a0 T _THDoubleTensor_newWithSize
000000000016e560 T _THDoubleTensor_newWithSize1d

nm -g libAten.dylib|grep THDoubleTensor_rawInit
(nothing)

thanks

Hi,

This is because it is an internal method that is not supposed to be called from outside.
You can see that it is not defined in the corresponding header (and this header is used to make the aten library and define what is exposed in the shared library).