From 2bd8ce9cfdff1acd01fd6e0919329dc60d7c3291 Mon Sep 17 00:00:00 2001 From: Yutao Xu Date: Thu, 29 Aug 2024 11:24:37 +0800 Subject: [PATCH] expm1: Align data type in computation with class definition (#835) Resolve the FP64 issue in the expm1 operator on ARC. --- src/ATen/native/xpu/sycl/UnaryKernels.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ATen/native/xpu/sycl/UnaryKernels.cpp b/src/ATen/native/xpu/sycl/UnaryKernels.cpp index 2ba855d34..ef404a4fd 100644 --- a/src/ATen/native/xpu/sycl/UnaryKernels.cpp +++ b/src/ATen/native/xpu/sycl/UnaryKernels.cpp @@ -234,8 +234,8 @@ struct Expm1Functor { template struct Expm1Functor> { c10::complex operator()(c10::complex x) const { - auto a = std::sin(.5 * x.imag()); - auto re = std::expm1(x.real()) * std::cos(x.imag()) - 2 * a * a; + auto a = std::sin(T(.5) * x.imag()); + auto re = std::expm1(x.real()) * std::cos(x.imag()) - T(2) * a * a; auto im = std::exp(x.real()) * std::sin(x.imag()); return c10::complex(re, im); }