From ef4177de79f4dc3389be9cb256349cca36e6e94b Mon Sep 17 00:00:00 2001 From: Tianlei Wu Date: Wed, 25 Sep 2024 20:30:43 +0000 Subject: [PATCH] update cuda clip --- onnxruntime/core/providers/cuda/math/clip.cc | 26 ++------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/onnxruntime/core/providers/cuda/math/clip.cc b/onnxruntime/core/providers/cuda/math/clip.cc index ea986798659e7..cceb489bcef00 100644 --- a/onnxruntime/core/providers/cuda/math/clip.cc +++ b/onnxruntime/core/providers/cuda/math/clip.cc @@ -59,33 +59,11 @@ Status Clip_6::ComputeInternal(OpKernelContext* ctx) const { return Status::OK(); } -namespace clip_internal { -template -struct LowMax { - constexpr static T low() { - return std::numeric_limits::lowest(); - } - constexpr static T max() { - return std::numeric_limits::max(); - } -}; - -template <> -struct LowMax { - static MLFloat16 low() { - return MLFloat16::FromBits(math::floatToHalf(std::numeric_limits::lowest())); - } - static MLFloat16 max() { - return MLFloat16::FromBits(math::floatToHalf(std::numeric_limits::max())); - } -}; -} // namespace clip_internal - template struct Clip::ComputeImpl { void operator()(cudaStream_t stream, const Tensor* X, const Tensor* min, const Tensor* max, Tensor* Y) const { - auto min_default = clip_internal::LowMax::low(); - auto max_default = clip_internal::LowMax::max(); + auto min_default = std::numeric_limits::lowest(); + auto max_default = std::numeric_limits::max(); const T* min_data = nullptr; const T* max_data = nullptr;