• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #pragma once
2 
3 #include <ATen/NumericUtils.h>
4 
5 namespace at::native {
6 
7 // std:: does not have clamp functors
8 template <typename T>
9 struct minimum {
operator ()at::native::minimum10   __device__ T operator()(const T& a, const T& b) const {
11     return (_isnan(a) || a < b) ? a : b;
12   }
13 };
14 
15 template <typename T>
16 struct maximum {
operator ()at::native::maximum17   __device__ T operator()(const T& a, const T& b) const {
18     return (_isnan(a) || a > b) ? a : b;
19   }
20 };
21 
22 } // namespace at::native
23