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