Caffe2 - C++ API
A deep learning, cross platform ML framework
utils.h
1 #ifndef TH_GENERIC_FILE
2 #define TH_GENERIC_FILE "torch/csrc/generic/utils.h"
3 #else
4 
5 #if defined(THD_GENERIC_FILE) || defined(TH_REAL_IS_HALF)
6 #define GENERATE_SPARSE 0
7 #else
8 #define GENERATE_SPARSE 1
9 #endif
10 
11 struct THPStorage;
12 struct THSPTensor;
13 
14 typedef class THPPointer<THWStorage> THWStoragePtr;
15 typedef class THPPointer<THWTensor> THWTensorPtr;
16 typedef class THPPointer<THPStorage> THPStoragePtr;
17 
18 #if (!defined(THC_GENERIC_FILE)) && \
19  (!defined(THD_GENERIC_FILE))
20 template<>
21 struct THPUtils_typeTraits<scalar_t> {
22 #if defined(TH_REAL_IS_FLOAT) || defined(TH_REAL_IS_DOUBLE) || \
23  defined(THC_REAL_IS_FLOAT) || defined(THC_REAL_IS_DOUBLE) || \
24  defined(THC_REAL_IS_HALF)
25  static constexpr char *python_type_str = "float";
26 #else
27  static constexpr char *python_type_str = "int";
28 #endif
29 };
30 #endif
31 
32 #undef GENERATE_SPARSE
33 
34 #endif