/usr/include/TH/THTensorMacros.h is in libtorch-th-dev 0~20170926-g89ede3b-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #ifndef TH_TENSOR_MACROS_INC
#define TH_TENSOR_MACROS_INC
/* fast method to access to tensor data */
#define THTensor_fastGet1d(self, x0) \
(((self)->storage->data+(self)->storageOffset)[(x0)*(self)->stride[0]])
#define THTensor_fastGet2d(self, x0, x1) \
(((self)->storage->data+(self)->storageOffset)[(x0)*(self)->stride[0]+(x1)*(self)->stride[1]])
#define THTensor_fastGet3d(self, x0, x1, x2) \
(((self)->storage->data+(self)->storageOffset)[(x0)*(self)->stride[0]+(x1)*(self)->stride[1]+(x2)*(self)->stride[2]])
#define THTensor_fastGet4d(self, x0, x1, x2, x3) \
(((self)->storage->data+(self)->storageOffset)[(x0)*(self)->stride[0]+(x1)*(self)->stride[1]+(x2)*(self)->stride[2]+(x3)*(self)->stride[3]])
#define THTensor_fastSet1d(self, x0, value) \
(((self)->storage->data+(self)->storageOffset)[(x0)*(self)->stride[0]] = value)
#define THTensor_fastSet2d(self, x0, x1, value) \
(((self)->storage->data+(self)->storageOffset)[(x0)*(self)->stride[0]+(x1)*(self)->stride[1]] = value)
#define THTensor_fastSet3d(self, x0, x1, x2, value) \
(((self)->storage->data+(self)->storageOffset)[(x0)*(self)->stride[0]+(x1)*(self)->stride[1]+(x2)*(self)->stride[2]] = value)
#define THTensor_fastSet4d(self, x0, x1, x2, x3, value) \
(((self)->storage->data+(self)->storageOffset)[(x0)*(self)->stride[0]+(x1)*(self)->stride[1]+(x2)*(self)->stride[2]+(x3)*(self)->stride[3]] = value)
#endif
|