1 #ifndef TH_GENERIC_FILE 2 #define TH_GENERIC_FILE "TH/generic/THTensor.h" 7 #include <c10/core/TensorImpl.h> 9 #define THTensor at::TensorImpl 13 #define THFloatTensor THTensor 14 #define THDoubleTensor THTensor 15 #define THHalfTensor THTensor 16 #define THByteTensor THTensor 17 #define THCharTensor THTensor 18 #define THShortTensor THTensor 19 #define THIntTensor THTensor 20 #define THLongTensor THTensor 21 #define THBoolTensor THTensor 24 TH_API THStorage* THTensor_(storage)(
const THTensor *
self);
25 TH_API ptrdiff_t THTensor_(storageOffset)(
const THTensor *
self);
28 TH_API
int THTensor_(nDimension)(
const THTensor *
self);
29 TH_API
int THTensor_(nDimensionLegacyNoScalars)(
const THTensor *
self);
30 TH_API
int THTensor_(nDimensionLegacyAll)(
const THTensor *
self);
31 TH_API int64_t THTensor_(size)(
const THTensor *
self,
int dim);
32 TH_API int64_t THTensor_(stride)(
const THTensor *
self,
int dim);
33 TH_API scalar_t *THTensor_(data)(
const THTensor *
self);
37 TH_API THTensor *THTensor_(
new)(void);
38 TH_API THTensor *THTensor_(newWithTensor)(THTensor *tensor);
39 TH_API THTensor *THTensor_(newWithStorage1d)(THStorage *storage_, ptrdiff_t storageOffset_,
40 int64_t size0_, int64_t stride0_);
41 TH_API THTensor *THTensor_(newWithStorage2d)(THStorage *storage_, ptrdiff_t storageOffset_,
42 int64_t size0_, int64_t stride0_,
43 int64_t size1_, int64_t stride1_);
44 TH_API THTensor *THTensor_(newWithStorage3d)(THStorage *storage_, ptrdiff_t storageOffset_,
45 int64_t size0_, int64_t stride0_,
46 int64_t size1_, int64_t stride1_,
47 int64_t size2_, int64_t stride2_);
48 TH_API THTensor *THTensor_(newWithStorage4d)(THStorage *storage_, ptrdiff_t storageOffset_,
49 int64_t size0_, int64_t stride0_,
50 int64_t size1_, int64_t stride1_,
51 int64_t size2_, int64_t stride2_,
52 int64_t size3_, int64_t stride3_);
55 TH_API THTensor *THTensor_(newWithSize1d)(int64_t size0_);
56 TH_API THTensor *THTensor_(newWithSize2d)(int64_t size0_, int64_t size1_);
57 TH_API THTensor *THTensor_(newWithSize3d)(int64_t size0_, int64_t size1_, int64_t size2_);
58 TH_API THTensor *THTensor_(newWithSize4d)(int64_t size0_, int64_t size1_, int64_t size2_, int64_t size3_);
60 TH_API THTensor *THTensor_(newClone)(THTensor *
self);
61 TH_API THTensor *THTensor_(newContiguous)(THTensor *tensor);
62 TH_API THTensor *THTensor_(newSelect)(THTensor *tensor,
int dimension_, int64_t sliceIndex_);
63 TH_API THTensor *THTensor_(newNarrow)(THTensor *tensor,
int dimension_, int64_t firstIndex_, int64_t size_);
64 TH_API THTensor *THTensor_(newTranspose)(THTensor *tensor,
int dimension1_,
int dimension2_);
65 TH_API THTensor *THTensor_(newUnfold)(THTensor *tensor,
int dimension_, int64_t size_, int64_t step_);
70 TH_API
void THTensor_(resizeNd)(THTensor *tensor,
int nDimension,
const int64_t *size,
const int64_t *stride);
71 TH_API
void THTensor_(resizeAs)(THTensor *tensor, THTensor *src);
72 TH_API
void THTensor_(resize0d)(THTensor *tensor);
73 TH_API
void THTensor_(resize1d)(THTensor *tensor, int64_t size0_);
74 TH_API
void THTensor_(resize2d)(THTensor *tensor, int64_t size0_, int64_t size1_);
75 TH_API
void THTensor_(resize3d)(THTensor *tensor, int64_t size0_, int64_t size1_, int64_t size2_);
76 TH_API
void THTensor_(resize4d)(THTensor *tensor, int64_t size0_, int64_t size1_, int64_t size2_, int64_t size3_);
77 TH_API
void THTensor_(resize5d)(THTensor *tensor, int64_t size0_, int64_t size1_, int64_t size2_, int64_t size3_, int64_t size4_);
80 TH_API
void THTensor_(
set)(THTensor *
self, THTensor *src);
81 TH_API
void THTensor_(setStorageNd)(THTensor *
self, THStorage *storage_, ptrdiff_t storageOffset_,
int nDimension,
const int64_t *size,
const int64_t *stride);
82 TH_API
void THTensor_(setStorage1d)(THTensor *
self, THStorage *storage_, ptrdiff_t storageOffset_,
83 int64_t size0_, int64_t stride0_);
84 TH_API
void THTensor_(setStorage2d)(THTensor *
self, THStorage *storage_, ptrdiff_t storageOffset_,
85 int64_t size0_, int64_t stride0_,
86 int64_t size1_, int64_t stride1_);
87 TH_API
void THTensor_(setStorage3d)(THTensor *
self, THStorage *storage_, ptrdiff_t storageOffset_,
88 int64_t size0_, int64_t stride0_,
89 int64_t size1_, int64_t stride1_,
90 int64_t size2_, int64_t stride2_);
91 TH_API
void THTensor_(setStorage4d)(THTensor *
self, THStorage *storage_, ptrdiff_t storageOffset_,
92 int64_t size0_, int64_t stride0_,
93 int64_t size1_, int64_t stride1_,
94 int64_t size2_, int64_t stride2_,
95 int64_t size3_, int64_t stride3_);
97 TH_API
void THTensor_(narrow)(THTensor *
self, THTensor *src,
int dimension_, int64_t firstIndex_, int64_t size_);
98 TH_API
void THTensor_(select)(THTensor *
self, THTensor *src,
int dimension_, int64_t sliceIndex_);
99 TH_API
void THTensor_(transpose)(THTensor *
self, THTensor *src,
int dimension1_,
int dimension2_);
100 TH_API
int THTensor_(isTransposed)(
const THTensor *
self);
101 TH_API
void THTensor_(unfold)(THTensor *
self, THTensor *src,
int dimension_, int64_t size_, int64_t step_);
103 TH_API
void THTensor_(squeeze)(THTensor *
self, THTensor *src);
104 TH_API
void THTensor_(squeeze1d)(THTensor *
self, THTensor *src,
int dimension_);
105 TH_API
void THTensor_(unsqueeze1d)(THTensor *
self, THTensor *src,
int dimension_);
107 TH_API
int THTensor_(isContiguous)(
const THTensor *
self);
108 TH_API
int THTensor_(isSameSizeAs)(
const THTensor *
self,
const THTensor *src);
109 TH_API
int THTensor_(isSetTo)(
const THTensor *
self,
const THTensor *src);
110 TH_API ptrdiff_t THTensor_(nElement)(
const THTensor *
self);
112 TH_API
void THTensor_(retain)(THTensor *
self);
113 TH_API
void THTensor_(free)(THTensor *
self);
114 TH_API
void THTensor_(freeCopyTo)(THTensor *
self, THTensor *dst);
117 TH_API
void THTensor_(set0d)(THTensor *tensor, scalar_t value);
118 TH_API
void THTensor_(set1d)(THTensor *tensor, int64_t x0, scalar_t value);
119 TH_API
void THTensor_(set2d)(THTensor *tensor, int64_t x0, int64_t x1, scalar_t value);
120 TH_API
void THTensor_(set3d)(THTensor *tensor, int64_t x0, int64_t x1, int64_t x2, scalar_t value);
121 TH_API
void THTensor_(set4d)(THTensor *tensor, int64_t x0, int64_t x1, int64_t x2, int64_t x3, scalar_t value);
123 TH_API scalar_t THTensor_(get0d)(
const THTensor *tensor);
124 TH_API scalar_t THTensor_(get1d)(
const THTensor *tensor, int64_t x0);
125 TH_API scalar_t THTensor_(get2d)(
const THTensor *tensor, int64_t x0, int64_t x1);
126 TH_API scalar_t THTensor_(get3d)(
const THTensor *tensor, int64_t x0, int64_t x1, int64_t x2);
127 TH_API scalar_t THTensor_(get4d)(
const THTensor *tensor, int64_t x0, int64_t x1, int64_t x2, int64_t x3);
130 TH_API
void THTensor_(cat)(THTensor *r_, THTensor *ta, THTensor *tb,
int dimension);
131 TH_API
void THTensor_(catArray)(THTensor *result, THTensor **inputs,
int numInputs,
int dimension);
134 TH_API THDescBuff THTensor_(desc)(
const THTensor *tensor);
135 TH_API THDescBuff THTensor_(sizeDesc)(
const THTensor *tensor);