From f1e004b954c2a6a0dc8d2ac03042bcf75eae49d0 Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Wed, 17 Feb 2021 22:05:31 -0800 Subject: [PATCH] Fix compiler warning for MathConstants.h (#52123) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/52123 Compiler currently complains: ``` caffe2/c10/util/MatchConstants.h(18): warning: calling a constexpr __host__ function("from_bits") from a __host__ __device__ function("pi") is not allowed. ``` This diff extirpates the warning Test Plan: Sandcastle tests Reviewed By: xush6528 Differential Revision: D26379485 fbshipit-source-id: ab4821119cba8c43fd1d5788c4632d0613529ec8 --- c10/util/BFloat16.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c10/util/BFloat16.h b/c10/util/BFloat16.h index 0bd115d568f..ce0d229b72c 100644 --- a/c10/util/BFloat16.h +++ b/c10/util/BFloat16.h @@ -81,7 +81,7 @@ struct alignas(2) BFloat16 { #endif struct from_bits_t {}; - static constexpr from_bits_t from_bits() { + static constexpr C10_HOST_DEVICE from_bits_t from_bits() { return from_bits_t(); }