PyTorch
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Functions
Half.h File Reference
#include <c10/macros/Macros.h>
#include <c10/util/C++17.h>
#include <c10/util/TypeSafeSignMath.h>
#include <c10/util/complex.h>
#include <type_traits>
#include <math.h>
#include <stdint.h>
#include <complex>
#include <cstdint>
#include <cstring>
#include <iosfwd>
#include <limits>
#include <sstream>
#include <stdexcept>
#include <string>
#include <utility>
#include <typeinfo>
#include <c10/util/Half-inl.h>

Go to the source code of this file.

Classes

struct  c10::Half
 
struct  c10::Half::from_bits_t
 
struct  c10::complex< Half >
 

Namespaces

namespace  c10
 
namespace  c10::detail
 

Macros

#define C10_DEVICE_HOST_FUNCTION
 Defines the Half type (half-precision floating-point) including conversions to standard C types and basic arithmetic operations. More...
 

Functions

float c10::detail::fp32_from_bits (uint32_t w)
 
uint32_t c10::detail::fp32_to_bits (float f)
 
uint32_t c10::detail::fp16_ieee_to_fp32_bits (uint16_t h)
 
float c10::detail::fp16_ieee_to_fp32_value (uint16_t h)
 
uint16_t c10::detail::fp16_ieee_from_fp32_value (float f)
 
template<typename To , typename From >
std::enable_if< std::is_same< From, bool >::value, bool >::type c10::overflows (From)
 
template<typename To , typename From >
std::enable_if< std::is_integral< From >::value &&!std::is_same< From, bool >::value, bool >::type c10::overflows (From f)
 
template<typename To , typename From >
std::enable_if< std::is_floating_point< From >::value, bool >::type c10::overflows (From f)
 
template<typename To , typename From >
std::enable_if< is_complex< From >::value, bool >::type c10::overflows (From f)
 
std::ostream & c10::operator<< (std::ostream &out, const Half &value)
 

Macro Definition Documentation

◆ C10_DEVICE_HOST_FUNCTION

#define C10_DEVICE_HOST_FUNCTION

Defines the Half type (half-precision floating-point) including conversions to standard C types and basic arithmetic operations.

Note that arithmetic operations are implemented by converting to floating point and performing the operation in float32, instead of using CUDA half intrinsics. Most uses of this type within ATen are memory bound, including the element-wise kernels, and the half intrinsics aren't efficient on all GPUs. If you are writing a compute bound kernel, you can use the CUDA half intrinsics directly on the Half type from device code.