diff --git a/c10/util/BFloat16.h b/c10/util/BFloat16.h index 09d3051ab71..ad1271fc729 100644 --- a/c10/util/BFloat16.h +++ b/c10/util/BFloat16.h @@ -8,7 +8,9 @@ #include #include #include +#ifndef C10_EMBEDDED #include +#endif // C10_EMBEDDED #if defined(__CUDACC__) && !defined(USE_ROCM) #include @@ -114,12 +116,14 @@ struct alignas(2) BFloat16 { #endif }; +#ifndef C10_EMBEDDED C10_API inline std::ostream& operator<<( std::ostream& out, const BFloat16& value) { out << (float)value; return out; } +#endif // C10_EMBEDDED } // namespace c10 diff --git a/c10/util/Half.h b/c10/util/Half.h index c0085798a96..c7c17485ba8 100644 --- a/c10/util/Half.h +++ b/c10/util/Half.h @@ -29,7 +29,9 @@ #include #include #include +#ifndef C10_EMBEDDED #include +#endif // C10_EMBEDDED #ifdef __CUDACC__ #include @@ -384,10 +386,12 @@ struct alignas(2) Half { #endif }; +#ifndef C10_EMBEDDED C10_API inline std::ostream& operator<<(std::ostream& out, const Half& value) { out << (float)value; return out; } +#endif // C10_EMBEDDED } // namespace c10