1 #ifndef THC_GENERIC_FILE 2 #define THC_GENERIC_FILE "THC/generic/THCTensor.h" 5 #define THCTensor THTensor 9 #define THCudaTensor THCTensor 10 #define THCudaDoubleTensor THCTensor 11 #define THCudaHalfTensor THCTensor 12 #define THCudaByteTensor THCTensor 13 #define THCudaCharTensor THCTensor 14 #define THCudaShortTensor THCTensor 15 #define THCudaIntTensor THCTensor 16 #define THCudaLongTensor THCTensor 17 #define THCudaBoolTensor THCTensor 20 THC_API THCStorage* THCTensor_(storage)(THCState *state,
const THCTensor *
self);
21 THC_API ptrdiff_t THCTensor_(storageOffset)(THCState *state,
const THCTensor *
self);
24 THC_API
int THCTensor_(nDimension)(THCState *state,
const THCTensor *
self);
25 THC_API
int THCTensor_(nDimensionLegacyNoScalars)(THCState *state,
const THCTensor *
self);
26 THC_API
int THCTensor_(nDimensionLegacyAll)(THCState *state,
const THCTensor *
self);
28 THC_API int64_t THCTensor_(size)(THCState *state,
const THCTensor *
self,
int dim);
29 THC_API int64_t THCTensor_(sizeLegacyNoScalars)(THCState *state,
const THCTensor *
self,
int dim);
30 THC_API int64_t THCTensor_(stride)(THCState *state,
const THCTensor *
self,
int dim);
31 THC_API int64_t THCTensor_(strideLegacyNoScalars)(THCState *state,
const THCTensor *
self,
int dim);
32 THC_API scalar_t *THCTensor_(data)(THCState *state,
const THCTensor *
self);
34 THC_API
void THCTensor_(setFlag)(THCState *state, THCTensor *
self,
const char flag);
35 THC_API
void THCTensor_(clearFlag)(THCState *state, THCTensor *
self,
const char flag);
39 THC_API THCTensor *THCTensor_(
new)(THCState *state);
40 THC_API THCTensor *THCTensor_(newWithTensor)(THCState *state, THCTensor *tensor);
41 THC_API THCTensor *THCTensor_(newWithStorage1d)(THCState *state, THCStorage *storage_, ptrdiff_t storageOffset_,
42 int64_t size0_, int64_t stride0_);
43 THC_API THCTensor *THCTensor_(newWithStorage2d)(THCState *state, THCStorage *storage_, ptrdiff_t storageOffset_,
44 int64_t size0_, int64_t stride0_,
45 int64_t size1_, int64_t stride1_);
46 THC_API THCTensor *THCTensor_(newWithStorage3d)(THCState *state, THCStorage *storage_, ptrdiff_t storageOffset_,
47 int64_t size0_, int64_t stride0_,
48 int64_t size1_, int64_t stride1_,
49 int64_t size2_, int64_t stride2_);
50 THC_API THCTensor *THCTensor_(newWithStorage4d)(THCState *state, THCStorage *storage_, ptrdiff_t storageOffset_,
51 int64_t size0_, int64_t stride0_,
52 int64_t size1_, int64_t stride1_,
53 int64_t size2_, int64_t stride2_,
54 int64_t size3_, int64_t stride3_);
57 THC_API THCTensor *THCTensor_(newWithSize1d)(THCState *state, int64_t size0_);
58 THC_API THCTensor *THCTensor_(newWithSize2d)(THCState *state, int64_t size0_, int64_t size1_);
59 THC_API THCTensor *THCTensor_(newWithSize3d)(THCState *state, int64_t size0_, int64_t size1_, int64_t size2_);
60 THC_API THCTensor *THCTensor_(newWithSize4d)(THCState *state, int64_t size0_, int64_t size1_, int64_t size2_, int64_t size3_);
62 THC_API THCTensor *THCTensor_(newClone)(THCState *state, THCTensor *
self);
63 THC_API THCTensor *THCTensor_(newContiguous)(THCState *state, THCTensor *tensor);
64 THC_API THCTensor *THCTensor_(newSelect)(THCState *state, THCTensor *tensor,
int dimension_, int64_t sliceIndex_);
65 THC_API THCTensor *THCTensor_(newNarrow)(THCState *state, THCTensor *tensor,
int dimension_, int64_t firstIndex_, int64_t size_);
66 THC_API THCTensor *THCTensor_(newTranspose)(THCState *state, THCTensor *tensor,
int dimension1_,
int dimension2_);
67 THC_API THCTensor *THCTensor_(newUnfold)(THCState *state, THCTensor *tensor,
int dimension_, int64_t size_, int64_t step_);
68 THC_API THCTensor *THCTensor_(newFoldBatchDim)(THCState *state, THCTensor *input);
73 THC_API
void THCTensor_(resizeNd)(THCState *state, THCTensor *tensor,
int nDimension,
const int64_t *size,
const int64_t *stride);
74 THC_API
void THCTensor_(resizeAs)(THCState *state, THCTensor *tensor, THCTensor *src);
75 THC_API
void THCTensor_(resize0d)(THCState *state, THCTensor *tensor);
76 THC_API
void THCTensor_(resize1d)(THCState *state, THCTensor *tensor, int64_t size0_);
77 THC_API
void THCTensor_(resize2d)(THCState *state, THCTensor *tensor, int64_t size0_, int64_t size1_);
78 THC_API
void THCTensor_(resize3d)(THCState *state, THCTensor *tensor, int64_t size0_, int64_t size1_, int64_t size2_);
79 THC_API
void THCTensor_(resize4d)(THCState *state, THCTensor *tensor, int64_t size0_, int64_t size1_, int64_t size2_, int64_t size3_);
80 THC_API
void THCTensor_(resize5d)(THCState *state, THCTensor *tensor, int64_t size0_, int64_t size1_, int64_t size2_, int64_t size3_, int64_t size4_);
82 THC_API
void THCTensor_(
set)(THCState *state, THCTensor *
self, THCTensor *src);
83 THC_API
void THCTensor_(setStorageNd)(THCState *state, THCTensor *
self, THCStorage *storage, ptrdiff_t storageOffset,
int nDimension,
const int64_t *size,
const int64_t *stride);
84 THC_API
void THCTensor_(setStorage1d)(THCState *state, THCTensor *
self, THCStorage *storage_, ptrdiff_t storageOffset_,
85 int64_t size0_, int64_t stride0_);
86 THC_API
void THCTensor_(setStorage2d)(THCState *state, THCTensor *
self, THCStorage *storage_, ptrdiff_t storageOffset_,
87 int64_t size0_, int64_t stride0_,
88 int64_t size1_, int64_t stride1_);
89 THC_API
void THCTensor_(setStorage3d)(THCState *state, THCTensor *
self, THCStorage *storage_, ptrdiff_t storageOffset_,
90 int64_t size0_, int64_t stride0_,
91 int64_t size1_, int64_t stride1_,
92 int64_t size2_, int64_t stride2_);
93 THC_API
void THCTensor_(setStorage4d)(THCState *state, THCTensor *
self, THCStorage *storage_, ptrdiff_t storageOffset_,
94 int64_t size0_, int64_t stride0_,
95 int64_t size1_, int64_t stride1_,
96 int64_t size2_, int64_t stride2_,
97 int64_t size3_, int64_t stride3_);
99 THC_API
void THCTensor_(narrow)(THCState *state, THCTensor *
self, THCTensor *src,
int dimension_, int64_t firstIndex_, int64_t size_);
100 THC_API
void THCTensor_(select)(THCState *state, THCTensor *
self, THCTensor *src,
int dimension_, int64_t sliceIndex_);
101 THC_API
void THCTensor_(transpose)(THCState *state, THCTensor *
self, THCTensor *src,
int dimension1_,
int dimension2_);
102 THC_API
void THCTensor_(unfold)(THCState *state, THCTensor *
self, THCTensor *src,
int dimension_, int64_t size_, int64_t step_);
104 THC_API
void THCTensor_(squeeze)(THCState *state, THCTensor *
self, THCTensor *src);
105 THC_API
void THCTensor_(squeeze1d)(THCState *state, THCTensor *
self, THCTensor *src,
int dimension_);
106 THC_API
void THCTensor_(unsqueeze1d)(THCState *state, THCTensor *
self, THCTensor *src,
int dimension_);
108 THC_API
int THCTensor_(isContiguous)(THCState *state,
const THCTensor *
self);
109 THC_API
int THCTensor_(isSameSizeAs)(THCState *state,
const THCTensor *
self,
const THCTensor *src);
110 THC_API
int THCTensor_(isSetTo)(THCState *state,
const THCTensor *
self,
const THCTensor *src);
111 THC_API ptrdiff_t THCTensor_(nElement)(THCState *state,
const THCTensor *
self);
113 THC_API
void THCTensor_(retain)(THCState *state, THCTensor *
self);
114 THC_API
void THCTensor_(free)(THCState *state, THCTensor *
self);
115 THC_API
void THCTensor_(freeCopyTo)(THCState *state, THCTensor *
self, THCTensor *dst);
118 THC_API
void THCTensor_(set0d)(THCState *state, THCTensor *tensor, scalar_t value);
119 THC_API
void THCTensor_(set1d)(THCState *state, THCTensor *tensor, int64_t x0, scalar_t value);
120 THC_API
void THCTensor_(set2d)(THCState *state, THCTensor *tensor, int64_t x0, int64_t x1, scalar_t value);
121 THC_API
void THCTensor_(set3d)(THCState *state, THCTensor *tensor, int64_t x0, int64_t x1, int64_t x2, scalar_t value);
122 THC_API
void THCTensor_(set4d)(THCState *state, THCTensor *tensor, int64_t x0, int64_t x1, int64_t x2, int64_t x3, scalar_t value);
124 THC_API scalar_t THCTensor_(get0d)(THCState *state,
const THCTensor *tensor);
125 THC_API scalar_t THCTensor_(get1d)(THCState *state,
const THCTensor *tensor, int64_t x0);
126 THC_API scalar_t THCTensor_(get2d)(THCState *state,
const THCTensor *tensor, int64_t x0, int64_t x1);
127 THC_API scalar_t THCTensor_(get3d)(THCState *state,
const THCTensor *tensor, int64_t x0, int64_t x1, int64_t x2);
128 THC_API scalar_t THCTensor_(get4d)(THCState *state,
const THCTensor *tensor, int64_t x0, int64_t x1, int64_t x2, int64_t x3);
131 THC_API
int THCTensor_(getDevice)(THCState *state,
const THCTensor *
self);
132 THC_API
int THCTensor_(checkGPU)(THCState *state,
unsigned int nTensors, ...);
135 THC_API
THCDescBuff THCTensor_(sizeDesc)(THCState *state,
const THCTensor *tensor);