xref: /aosp_15_r20/external/pytorch/aten/src/ATen/mkl/Utils.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #include <mkl_types.h>
4 
mkl_int_cast(int64_t value,const char * varname)5 static inline MKL_INT mkl_int_cast(int64_t value, const char* varname) {
6   auto result = static_cast<MKL_INT>(value);
7   TORCH_CHECK(
8       static_cast<int64_t>(result) == value,
9       "mkl_int_cast: The value of ",
10       varname,
11       "(",
12       (long long)value,
13       ") is too large to fit into a MKL_INT (",
14       sizeof(MKL_INT),
15       " bytes)");
16   return result;
17 }
18