Caffe2 - C++ API
A deep learning, cross platform ML framework
logging_is_google_glog.h
1 #ifndef CAFFE2_CORE_LOGGING_IS_GOOGLE_GLOG_H_
2 #define CAFFE2_CORE_LOGGING_IS_GOOGLE_GLOG_H_
3 
4 #include <iomanip> // because some of the caffe2 code uses e.g. std::setw
5 // Using google glog. For glog 0.3.2 versions, stl_logging.h needs to be before
6 // logging.h to actually use stl_logging. Because template magic.
7 // In addition, we do not do stl logging in .cu files because nvcc does not like
8 // it. Some mobile platforms do not like stl_logging, so we add an
9 // overload in that case as well.
10 
11 #if !defined(__CUDACC__) && !defined(CAFFE2_USE_MINIMAL_GOOGLE_GLOG)
12 #include <glog/stl_logging.h>
13 #else // !defined(__CUDACC__) && !!defined(CAFFE2_USE_MINIMAL_GOOGLE_GLOG)
14 
15 // here, we need to register a fake overload for vector/string - here,
16 // we just ignore the entries in the logs.
17 
18 #define INSTANTIATE_FOR_CONTAINER(container) \
19  template <class... Types> \
20  std::ostream& operator<<(std::ostream& out, const container<Types...>&) { \
21  return out; \
22  }
23 
24 INSTANTIATE_FOR_CONTAINER(std::vector)
25 INSTANTIATE_FOR_CONTAINER(std::map)
26 INSTANTIATE_FOR_CONTAINER(std::set)
27 #undef INSTANTIATE_FOR_CONTAINER
28 
29 #endif
30 
31 #include <glog/logging.h>
32 
33 
34 #endif // CAFFE2_CORE_LOGGING_IS_GOOGLE_GLOG_H_
Definition: types.h:72