mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
This PR Move `operator<<` of `BFloat16` to `BFloat16.h`. Previously, this function is in `TensorDataContainer.h`. If need `std::cout` a `BFloat16` variable when debugging, `TensorDataContainer.h` have to be included. This is inconvient and counterintuitive. Other dtypes such as `Half`, define their `operator<<` in headers where they are defined such as `Half.h`. Therefore, I think it makes more sense to move `operator<<` of `BFloat16` to `BFloat16.h` Pull Request resolved: https://github.com/pytorch/pytorch/pull/121302 Approved by: https://github.com/ezyang
15 lines
328 B
C++
15 lines
328 B
C++
#include <c10/util/Float8_e4m3fnuz.h>
|
|
#include <ostream>
|
|
|
|
namespace c10 {
|
|
|
|
static_assert(
|
|
std::is_standard_layout_v<Float8_e4m3fnuz>,
|
|
"c10::Float8_e4m3fnuz must be standard layout.");
|
|
|
|
std::ostream& operator<<(std::ostream& out, const Float8_e4m3fnuz& value) {
|
|
out << (float)value;
|
|
return out;
|
|
}
|
|
|
|
} // namespace c10
|