1 #ifndef CAFFE2_CORE_COMMON_H_ 2 #define CAFFE2_CORE_COMMON_H_ 3 4 #include <algorithm> 5 #include <cmath> 6 #include <map> 7 #include <memory> 8 #include <numeric> 9 #include <set> 10 #include <sstream> 11 #include <string> 12 #include <type_traits> 13 #include <vector> 14 15 #ifdef __APPLE__ 16 #include <TargetConditionals.h> 17 #endif 18 19 #if defined(_MSC_VER) 20 #include <io.h> 21 #else 22 #include <unistd.h> 23 #endif 24 25 // Macros used during the build of this caffe2 instance. This header file 26 // is automatically generated by the cmake script during build. 27 #include "caffe2/core/macros.h" 28 29 #include <c10/macros/Macros.h> 30 31 namespace caffe2 { 32 33 // Using statements for common classes that we refer to in caffe2 very often. 34 // Note that we only place it inside caffe2 so the global namespace is not 35 // polluted. 36 /* using override */ 37 using std::set; 38 using std::string; 39 using std::unique_ptr; 40 using std::vector; 41 42 // Define alignment macro that is cross platform 43 #if (defined _MSC_VER && !defined NOMINMAX) 44 #define NOMINMAX 45 #endif 46 47 using std::make_unique; 48 49 #if defined(__ANDROID__) && !defined(__NDK_MAJOR__) 50 using ::round; 51 #else 52 using std::round; 53 #endif // defined(__ANDROID__) && !defined(__NDK_MAJOR__) 54 55 // Returns which setting Caffe2 was configured and built with (exported from 56 // CMake) 57 TORCH_API const std::map<string, string>& GetBuildOptions(); 58 59 } // namespace caffe2 60 61 #endif // CAFFE2_CORE_COMMON_H_ 62