pytorch/c10/util/Half.cpp
Davide Libenzi 8420a2025b Turn the Half::from_bits into a constexpr function to avoid unresolve… (#17661)
Summary:
…d symbol errors when building in DEBUG mode.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17661

Differential Revision: D14319610

Pulled By: soumith

fbshipit-source-id: 6c508a37155e29260f403d7174f343aa1ff32385
2019-03-05 07:31:38 -08:00

16 lines
291 B
C++

#include <c10/util/Half.h>
#include <iostream>
namespace c10 {
static_assert(
std::is_standard_layout<Half>::value,
"c10::Half must be standard layout.");
std::ostream& operator<<(std::ostream& out, const Half& value) {
out << (float)value;
return out;
}
} // namespace c10