/usr/local/lib64/python3.6/site-packages/torch/include/c10/util
NameSizeModeActions
accumulate.h42050644editdlrm
AlignOf.h48350644editdlrm
Array.h113540644editdlrm
ArrayRef.h90580644editdlrm
Backtrace.h3640644editdlrm
BFloat16-inl.h92220644editdlrm
BFloat16-math.h52170644editdlrm
BFloat16.h23720644editdlrm
Bitset.h34140644editdlrm
C++17.h133290644editdlrm
complex.h175420644editdlrm
complex_math.h109020644editdlrm
complex_utils.h9580644editdlrm
ConstexprCrc.h66330644editdlrm
copysign.h8660644editdlrm
DeadlockDetection.h19200644editdlrm
Deprecated.h35790644editdlrm
either.h64230644editdlrm
env.h8350644editdlrm
Exception.h247230644editdlrm
ExclusivelyOwned.h47590644editdlrm
Flags.h100560644editdlrm
flat_hash_map.h616550644editdlrm
FunctionRef.h23010644editdlrm
Half-inl.h86740644editdlrm
Half.h189650644editdlrm
hash.h50840644editdlrm
IdWrapper.h23480644editdlrm
intrusive_ptr.h355630644editdlrm
in_place.h3500644editdlrm
irange.h26790644editdlrm
LeftRight.h60160644editdlrm
llvmMathExtras.h291680644editdlrm
Logging.h112560644editdlrm
logging_is_google_glog.h20310644editdlrm
logging_is_not_google_glog.h82710644editdlrm
MathConstants.h8580644editdlrm
math_compat.h72960644editdlrm
MaybeOwned.h66890644editdlrm
Metaprogramming.h152880644editdlrm
numa.h6960644editdlrm
Optional.h355920644editdlrm
order_preserving_flat_hash_map.h654820644editdlrm
overloaded.h7090644editdlrm
python_stub.h560644editdlrm
qint8.h4720644editdlrm
qint32.h3190644editdlrm
quint4x2.h3660644editdlrm
quint8.h3200644editdlrm
Registry.h122420644editdlrm
reverse_iterator.h87960644editdlrm
ScopeExit.h13450644editdlrm
signal_handler.h31540644editdlrm
SmallBuffer.h12430644editdlrm
SmallVector.h344560644editdlrm
sparse_bitset.h265110644editdlrm
StringUtil.h45380644editdlrm
string_utils.h39890644editdlrm
string_view.h201890644editdlrm
tempfile.h60290644editdlrm
ThreadLocal.h38830644editdlrm
ThreadLocalDebugInfo.h26030644editdlrm
thread_name.h1480644editdlrm
Type.h6070644editdlrm
TypeCast.h69720644editdlrm
typeid.h187930644editdlrm
TypeIndex.h52510644editdlrm
TypeList.h169010644editdlrm
TypeTraits.h53680644editdlrm
Unicode.h2950644editdlrm
UniqueVoidPtr.h41170644editdlrm
Unroll.h6670644editdlrm
variant.h951820644editdlrm
win32-headers.h8580644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/include/c10/util/logging_is_not_google_glog.h (8271B)
#ifndef C10_UTIL_LOGGING_IS_NOT_GOOGLE_GLOG_H_ #define C10_UTIL_LOGGING_IS_NOT_GOOGLE_GLOG_H_ #include #include #include #include #include #include #include #include #include #include #include const char CAFFE2_SEVERITY_PREFIX[] = "FEWIV"; namespace c10 { // Log severity level constants. const int GLOG_FATAL = 3; const int GLOG_ERROR = 2; const int GLOG_WARNING = 1; const int GLOG_INFO = 0; class C10_API MessageLogger { public: MessageLogger(const char* file, int line, int severity); ~MessageLogger(); // Return the stream associated with the logger object. std::stringstream& stream() { return stream_; } private: // When there is a fatal log, we simply abort. void DealWithFatal() { abort(); } const char* tag_; std::stringstream stream_; int severity_; }; // This class is used to explicitly ignore values in the conditional // logging macros. This avoids compiler warnings like "value computed // is not used" and "statement has no effect". class C10_API LoggerVoidify { public: LoggerVoidify() {} // This has to be an operator with a precedence lower than << but // higher than ?: void operator&(const std::ostream& s) {} }; // Log a message and terminate. template void LogMessageFatal(const char* file, int line, const T& message) { MessageLogger(file, line, GLOG_FATAL).stream() << message; } // Helpers for CHECK_NOTNULL(). Two are necessary to support both raw pointers // and smart pointers. template T& CheckNotNullCommon(const char* file, int line, const char* names, T& t) { if (t == nullptr) { LogMessageFatal(file, line, std::string(names)); } return t; } template T* CheckNotNull(const char* file, int line, const char* names, T* t) { return CheckNotNullCommon(file, line, names, t); } template T& CheckNotNull(const char* file, int line, const char* names, T& t) { return CheckNotNullCommon(file, line, names, t); } } // namespace c10 // ---------------------- Logging Macro definitions -------------------------- static_assert( CAFFE2_LOG_THRESHOLD <= ::c10::GLOG_FATAL, "CAFFE2_LOG_THRESHOLD should at most be GLOG_FATAL."); // If n is under the compile time caffe log threshold, The _CAFFE_LOG(n) // should not generate anything in optimized code. #define LOG(n) \ if (::c10::GLOG_##n >= CAFFE2_LOG_THRESHOLD) \ ::c10::MessageLogger((char*)__FILE__, __LINE__, ::c10::GLOG_##n).stream() #define VLOG(n) \ if (-n >= CAFFE2_LOG_THRESHOLD) \ ::c10::MessageLogger((char*)__FILE__, __LINE__, -n).stream() #define LOG_IF(n, condition) \ if (::c10::GLOG_##n >= CAFFE2_LOG_THRESHOLD && (condition)) \ ::c10::MessageLogger((char*)__FILE__, __LINE__, ::c10::GLOG_##n).stream() #define VLOG_IF(n, condition) \ if (-n >= CAFFE2_LOG_THRESHOLD && (condition)) \ ::c10::MessageLogger((char*)__FILE__, __LINE__, -n).stream() #define VLOG_IS_ON(verboselevel) (CAFFE2_LOG_THRESHOLD <= -(verboselevel)) // Log with source location information override (to be used in generic // warning/error handlers implemented as functions, not macros) #define LOG_AT_FILE_LINE(n, file, line) \ if (::c10::GLOG_##n >= CAFFE2_LOG_THRESHOLD) \ ::c10::MessageLogger(file, line, ::c10::GLOG_##n).stream() // Log only if condition is met. Otherwise evaluates to void. #define FATAL_IF(condition) \ condition ? (void)0 \ : ::c10::LoggerVoidify() & \ ::c10::MessageLogger((char*)__FILE__, __LINE__, ::c10::GLOG_FATAL) \ .stream() // Check for a given boolean condition. #define CHECK(condition) FATAL_IF(condition) << "Check failed: " #condition " " #ifndef NDEBUG // Debug only version of CHECK #define DCHECK(condition) FATAL_IF(condition) << "Check failed: " #condition " " #else // Optimized version - generates no code. #define DCHECK(condition) \ while (false) \ CHECK(condition) #endif // NDEBUG #define CHECK_OP(val1, val2, op) \ FATAL_IF(((val1)op(val2))) << "Check failed: " #val1 " " #op " " #val2 " (" \ << (val1) << " vs. " << (val2) << ") " // Check_op macro definitions #define CHECK_EQ(val1, val2) CHECK_OP(val1, val2, ==) #define CHECK_NE(val1, val2) CHECK_OP(val1, val2, !=) #define CHECK_LE(val1, val2) CHECK_OP(val1, val2, <=) #define CHECK_LT(val1, val2) CHECK_OP(val1, val2, <) #define CHECK_GE(val1, val2) CHECK_OP(val1, val2, >=) #define CHECK_GT(val1, val2) CHECK_OP(val1, val2, >) #ifndef NDEBUG // Debug only versions of CHECK_OP macros. #define DCHECK_EQ(val1, val2) CHECK_OP(val1, val2, ==) #define DCHECK_NE(val1, val2) CHECK_OP(val1, val2, !=) #define DCHECK_LE(val1, val2) CHECK_OP(val1, val2, <=) #define DCHECK_LT(val1, val2) CHECK_OP(val1, val2, <) #define DCHECK_GE(val1, val2) CHECK_OP(val1, val2, >=) #define DCHECK_GT(val1, val2) CHECK_OP(val1, val2, >) #else // !NDEBUG // These versions generate no code in optimized mode. #define DCHECK_EQ(val1, val2) \ while (false) \ CHECK_OP(val1, val2, ==) #define DCHECK_NE(val1, val2) \ while (false) \ CHECK_OP(val1, val2, !=) #define DCHECK_LE(val1, val2) \ while (false) \ CHECK_OP(val1, val2, <=) #define DCHECK_LT(val1, val2) \ while (false) \ CHECK_OP(val1, val2, <) #define DCHECK_GE(val1, val2) \ while (false) \ CHECK_OP(val1, val2, >=) #define DCHECK_GT(val1, val2) \ while (false) \ CHECK_OP(val1, val2, >) #endif // NDEBUG // Check that a pointer is not null. #define CHECK_NOTNULL(val) \ ::c10::CheckNotNull( \ __FILE__, __LINE__, "Check failed: '" #val "' Must be non NULL", (val)) #ifndef NDEBUG // Debug only version of CHECK_NOTNULL #define DCHECK_NOTNULL(val) \ ::c10::CheckNotNull( \ __FILE__, __LINE__, "Check failed: '" #val "' Must be non NULL", (val)) #else // !NDEBUG // Optimized version - generates no code. #define DCHECK_NOTNULL(val) \ while (false) \ CHECK_NOTNULL(val) #endif // NDEBUG // ---------------------- Support for std objects -------------------------- // These are adapted from glog to support a limited set of logging capability // for STL objects. namespace std { // Forward declare these two, and define them after all the container streams // operators so that we can recurse from pair -> container -> container -> pair // properly. template std::ostream& operator<<(std::ostream& out, const std::pair& p); } // namespace std namespace c10 { template void PrintSequence(std::ostream& ss, Iter begin, Iter end); } // namespace c10 namespace std { #define INSTANTIATE_FOR_CONTAINER(container) \ template \ std::ostream& operator<<( \ std::ostream& out, const container& seq) { \ c10::PrintSequence(out, seq.begin(), seq.end()); \ return out; \ } INSTANTIATE_FOR_CONTAINER(std::vector) INSTANTIATE_FOR_CONTAINER(std::map) INSTANTIATE_FOR_CONTAINER(std::set) #undef INSTANTIATE_FOR_CONTAINER template inline std::ostream& operator<<( std::ostream& out, const std::pair& p) { out << '(' << p.first << ", " << p.second << ')'; return out; } inline std::ostream& operator<<(std::ostream& out, const std::nullptr_t&) { out << "(null)"; return out; } } // namespace std namespace c10 { template inline void PrintSequence(std::ostream& out, Iter begin, Iter end) { // Output at most 100 elements -- appropriate if used for logging. for (int i = 0; begin != end && i < 100; ++i, ++begin) { if (i > 0) out << ' '; out << *begin; } if (begin != end) { out << " ..."; } } } // namespace c10 #endif // C10_UTIL_LOGGING_IS_NOT_GOOGLE_GLOG_H_