Repository: pytorch
Issue: torch-1.11 Cross-Compiling for QNX 7.1.0 with aarch64le issue: no matching function for call to 'isnan(c10::BFloat16&)'
Labels: module: build,triaged

### 🐛 Describe the bug

Hi, 

I am going to use the torch-1.11 C++ API for QNX 7.1. and I got a compile error as below:
It should be converted from c10:BFloat16 to float by "c10::impl::ScalarTypeToCPPType". But seems it did not work. Can you give some advise for this problem? 

Thanks

Here is cmake file:
```shell
cmake "$CAFFE2_ROOT" \
-DCMAKE_TOOLCHAIN_FILE=/ws/arles/ArlesVision/cmake/Toolchain-V5Q.cmake \
-DCUDA_DIR=/ws/drive/cuda/cuda-safe-11.4 \
-DCUDA_INCLUDE_DIRS=/ws/drive/cuda/cuda-11.4/include \
-DVIBRANTE_PDK=/ws/drive/drive-qnx
```
The error log:
```shell
/ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/ReduceOps.cpp: In instantiation of 'bool at::native::{anonymous}::isnan_(T) [with T = c10::BFloat16]':
/ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/ReduceOps.cpp:658:18:   required from 'void at::native::cummax_cummin_helper(const T1*, T1*, T2*, int, int, int, int) [with T1 = c10::BFloat16; T2 = long int; Operation = std::__1::greater_equal<c10::BFloat16>]'
/ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/ReduceOps.cpp:668:3:   required from here
/ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/ReduceOps.cpp:644:20: error: no matching function for call to 'isnan(c10::BFloat16&)'
   return std::isnan(x);
          ~~~~~~~~~~^~~
In file included from /ws/drive/qnx710/target/qnx7/usr/include/c++/v1/cmath:305,
                 from /ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/c10/util/llvmMathExtras.h:18,
                 from /ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/c10/core/DispatchKeySet.h:6,
                 from /ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/c10/core/Backend.h:5,
                 from /ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/DispatchStub.h:3,
                 from /ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/ReduceOps.h:3,
                 from /ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/ReduceOps.cpp:1:
/ws/drive/qnx710/target/qnx7/usr/include/c++/v1/math.h:527:1: note: candidate: 'template<class _A1> typename std::__1::enable_if<std::__1::is_integral<_Tp>::value, bool>::type isnan(_A1)'
 isnan(_A1) _NOEXCEPT
 ^~~~~
/ws/drive/qnx710/target/qnx7/usr/include/c++/v1/math.h:527:1: note:   template argument deduction/substitution failed:
/ws/drive/qnx710/target/qnx7/usr/include/c++/v1/math.h: In substitution of 'template<class _A1> typename std::__1::enable_if<std::__1::is_integral<_Tp>::value, bool>::type isnan(_A1) [with _A1 = c10::BFloat16]':
/ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/ReduceOps.cpp:644:20:   required from 'bool at::native::{anonymous}::isnan_(T) [with T = c10::BFloat16]'
/ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/ReduceOps.cpp:658:18:   required from 'void at::native::cummax_cummin_helper(const T1*, T1*, T2*, int, int, int, int) [with T1 = c10::BFloat16; T2 = long int; Operation = std::__1::greater_equal<c10::BFloat16>]'
/ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/ReduceOps.cpp:668:3:   required from here
/ws/drive/qnx710/target/qnx7/usr/include/c++/v1/math.h:527:1: error: no type named 'type' in 'struct std::__1::enable_if<false, bool>'
/ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/ReduceOps.cpp: In instantiation of 'bool at::native::{anonymous}::isnan_(T) [with T = c10::BFloat16]':
/ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/ReduceOps.cpp:658:18:   required from 'void at::native::cummax_cummin_helper(const T1*, T1*, T2*, int, int, int, int) [with T1 = c10::BFloat16; T2 = long int; Operation = std::__1::greater_equal<c10::BFloat16>]'
/ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/ReduceOps.cpp:668:3:   required from here
/ws/drive/qnx710/target/qnx7/usr/include/c++/v1/math.h:519:1: note: candidate: 'template<class _A1> typename std::__1::enable_if<std::__1::is_floating_point<_Tp>::value, bool>::type isnan(_A1)'
 isnan(_A1 __lcpp_x) _NOEXCEPT
 ^~~~~
/ws/drive/qnx710/target/qnx7/usr/include/c++/v1/math.h:519:1: note:   template argument deduction/substitution failed:
/ws/drive/qnx710/target/qnx7/usr/include/c++/v1/math.h: In substitution of 'template<class _A1> typename std::__1::enable_if<std::__1::is_floating_point<_Tp>::value, bool>::type isnan(_A1) [with _A1 = c10::BFloat16]':
/ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/ReduceOps.cpp:644:20:   required from 'bool at::native::{anonymous}::isnan_(T) [with T = c10::BFloat16]'
/ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/ReduceOps.cpp:658:18:   required from 'void at::native::cummax_cummin_helper(const T1*, T1*, T2*, int, int, int, int) [with T1 = c10::BFloat16; T2 = long int; Operation = std::__1::greater_equal<c10::BFloat16>]'
/ws/arles/ArlesVision/3rdParty/pytorch-1.11.0/pytorch/aten/src/ATen/native/ReduceOps.cpp:668:3:   required from here
/ws/drive/qnx710/target/qnx7/usr/include/c++/v1/math.h:519:1: error: no type named 'type' in 'struct std::__1::enable_if<false, bool>'
caffe2/CMakeFiles/torch_cpu.dir/build.make:2816: recipe for target 'caffe2/CMakeFiles/torch_cpu.dir/__/aten/src/ATen/native/ReduceOps.cpp.o' failed
make[2]: *** [caffe2/CMakeFiles/torch_cpu.dir/__/aten/src/ATen/native/ReduceOps.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:1304: recipe for target 'caffe2/CMakeFiles/torch_cpu.dir/all' failed
make[1]: *** [caffe2/CMakeFiles/torch_cpu.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
make: *** [all] Error 2

```

### Versions

python 3.8.12 pytorch-1.11.0

cc @malfet @seemethere