Caffe2 - C++ API
A deep learning, cross platform ML framework
THCStorage.h
1 #ifndef THC_GENERIC_FILE
2 #define THC_GENERIC_FILE "THC/generic/THCStorage.h"
3 #else
4 
5 #define THCStorage THStorage
6 
7 // These used to be distinct types; for some measure of backwards compatibility and documentation
8 // alias these to the single THCStorage type.
9 #define THCudaStorage THCStorage
10 #define THCudaDoubleStorage THCStorage
11 #define THCudaHalfStorage THCStorage
12 #define THCudaByteStorage THCStorage
13 #define THCudaCharStorage THCStorage
14 #define THCudaShortStorage THCStorage
15 #define THCudaIntStorage THCStorage
16 #define THCudaLongStorage THCStorage
17 #define THCudaBoolStorage THCStorage
18 
19 THC_API scalar_t* THCStorage_(data)(THCState *state, const THCStorage*);
20 THC_API ptrdiff_t THCStorage_(size)(THCState *state, const THCStorage*);
21 THC_API int THCStorage_(elementSize)(THCState *state);
22 
23 /* slow access -- checks everything */
24 THC_API void THCStorage_(set)(THCState *state, THCStorage*, ptrdiff_t, scalar_t);
25 THC_API scalar_t THCStorage_(get)(THCState *state, const THCStorage*, ptrdiff_t);
26 
27 THC_API THCStorage* THCStorage_(new)(THCState *state);
28 THC_API THCStorage* THCStorage_(newWithSize)(THCState *state, ptrdiff_t size);
29 THC_API THCStorage* THCStorage_(newWithSize1)(THCState *state, scalar_t);
30 THC_API THCStorage* THCStorage_(newWithSize2)(THCState *state, scalar_t, scalar_t);
31 THC_API THCStorage* THCStorage_(newWithSize3)(THCState *state, scalar_t, scalar_t, scalar_t);
32 THC_API THCStorage* THCStorage_(newWithSize4)(THCState *state, scalar_t, scalar_t, scalar_t, scalar_t);
33 THC_API THCStorage* THCStorage_(newWithMapping)(THCState *state, const char *filename, ptrdiff_t size, int shared);
34 
35 THC_API THCStorage* THCStorage_(newWithAllocator)(
36  THCState *state, ptrdiff_t size,
37  at::Allocator* allocator);
38 THC_API THCStorage* THCStorage_(newWithDataAndAllocator)(
39  THCState *state, at::DataPtr&& data, ptrdiff_t size,
40  at::Allocator* allocator);
41 
42 THC_API void THCStorage_(setFlag)(THCState *state, THCStorage *storage, const char flag);
43 THC_API void THCStorage_(clearFlag)(THCState *state, THCStorage *storage, const char flag);
44 THC_API void THCStorage_(retain)(THCState *state, THCStorage *storage);
45 
46 THC_API void THCStorage_(free)(THCState *state, THCStorage *storage);
47 THC_API void THCStorage_(resize)(THCState *state, THCStorage *storage, ptrdiff_t size);
48 THC_API void THCStorage_(fill)(THCState *state, THCStorage *storage, scalar_t value);
49 
50 THC_API int THCStorage_(getDevice)(THCState* state, const THCStorage* storage);
51 
52 #endif