Remove C10_EMBEDDED (#144808)

I added this to support code sharing with ExecuTorch, but the operator<< overrides are load-bearing for builds -- we have other code that attempts to pretty-print Half/BFloat16, and implicit conversions can't be used to make that work because there are *multiple* implicit conversions from Half/BFloat16 to primitive types, so which one to select is ambiguous. Also, we don't actually seem to need it now in ExecuTorch core because we have `include <ostream>` in there at the moment anyway.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/144808
Approved by: https://github.com/janeyx99, https://github.com/malfet
This commit is contained in:
Scott Wolchok 2025-01-14 15:22:41 -08:00 committed by PyTorch MergeBot
parent b801210035
commit 69b883d7ac
2 changed files with 0 additions and 8 deletions

View file

@ -8,9 +8,7 @@
#include <cstdint>
#include <cstring>
#include <iosfwd>
#ifndef C10_EMBEDDED
#include <ostream>
#endif // C10_EMBEDDED
#if defined(__CUDACC__) && !defined(USE_ROCM)
#include <cuda_bf16.h>
@ -116,14 +114,12 @@ 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

View file

@ -29,9 +29,7 @@
#include <cstring>
#include <iosfwd>
#include <limits>
#ifndef C10_EMBEDDED
#include <ostream>
#endif // C10_EMBEDDED
#ifdef __CUDACC__
#include <cuda_fp16.h>
@ -411,12 +409,10 @@ 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