Caffe2 - C++ API
A deep learning, cross platform ML framework
half_utils.h
1 #ifndef CAFFE2_UTILS_MATH_HALF_UTILS_H_
2 #define CAFFE2_UTILS_MATH_HALF_UTILS_H_
3 
4 #include "caffe2/core/common.h"
5 #include "caffe2/core/types.h"
6 #include "caffe2/utils/conversions.h"
7 #include "caffe2/utils/math/utils.h"
8 
9 namespace caffe2 {
10 namespace math {
11 namespace utils {
12 
14  MATH_UTILS_DECL at::Half operator()(const at::Half a, const at::Half b)
15  const {
16  return convert::To<float, at::Half>(
17  convert::To<at::Half, float>(a) + convert::To<at::Half, float>(b));
18  }
19 };
20 
22  MATH_UTILS_DECL at::Half operator()(const at::Half a, const at::Half b)
23  const {
24  return convert::To<float, at::Half>(
25  convert::To<at::Half, float>(a) - convert::To<at::Half, float>(b));
26  }
27 };
28 
30  MATH_UTILS_DECL at::Half operator()(const at::Half a, const at::Half b)
31  const {
32  return convert::To<float, at::Half>(
33  convert::To<at::Half, float>(a) * convert::To<at::Half, float>(b));
34  }
35 };
36 
38  MATH_UTILS_DECL at::Half operator()(const at::Half a, const at::Half b)
39  const {
40  return convert::To<float, at::Half>(
41  convert::To<at::Half, float>(a) / convert::To<at::Half, float>(b));
42  }
43 };
44 
45 } // namespace utils
46 } // namespace math
47 } // namespace caffe2
48 
49 #endif // CAFFE2_UTILS_MATH_HALF_UTILS_H_
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13