8 #ifndef MSHADOW_BASE_H_ 9 #define MSHADOW_BASE_H_ 11 #ifndef _CRT_SECURE_NO_WARNINGS 12 #define _CRT_SECURE_NO_WARNINGS 14 #ifndef _CRT_SECURE_NO_DEPRECATE 15 #define _CRT_SECURE_NO_DEPRECATE 31 typedef signed char int8_t;
33 typedef __int16 int16_t;
34 typedef __int32 int32_t;
35 typedef __int64 int64_t;
36 typedef unsigned char uint8_t;
37 typedef unsigned __int16 uint16_t;
38 typedef unsigned __int32 uint32_t;
39 typedef unsigned __int64 uint64_t;
49 #ifndef MSHADOW_STAND_ALONE 50 #define MSHADOW_STAND_ALONE 0 53 #ifndef MSHADOW_ALLOC_PAD 54 #define MSHADOW_ALLOC_PAD true 64 #ifndef MSHADOW_MIN_PAD_RATIO 65 #define MSHADOW_MIN_PAD_RATIO 2 68 #if MSHADOW_STAND_ALONE 69 #define MSHADOW_USE_CBLAS 0 70 #define MSHADOW_USE_MKL 0 71 #define MSHADOW_USE_CUDA 0 78 #ifndef MSHADOW_FORCE_STREAM 79 #define MSHADOW_FORCE_STREAM 1 83 #ifndef MSHADOW_USE_CBLAS 84 #define MSHADOW_USE_CBLAS 0 87 #ifndef MSHADOW_USE_MKL 88 #define MSHADOW_USE_MKL 1 95 #ifndef MSHADOW_USE_CUDA 96 #define MSHADOW_USE_CUDA 1 102 #ifndef MSHADOW_USE_CUDNN 103 #define MSHADOW_USE_CUDNN 0 109 #ifndef MSHADOW_USE_CUSOLVER 110 #define MSHADOW_USE_CUSOLVER MSHADOW_USE_CUDA 117 #ifndef MSHADOW_OLD_CUDA 118 #define MSHADOW_OLD_CUDA 0 124 #ifndef MSHADOW_IN_CXX11 125 #if (defined(__GXX_EXPERIMENTAL_CXX0X__) ||\ 126 __cplusplus >= 201103L || defined(_MSC_VER)) 127 #define MSHADOW_IN_CXX11 1 129 #define MSHADOW_IN_CXX11 0 134 #ifndef MSHADOW_USE_SSE 135 #define MSHADOW_USE_SSE 1 139 #ifndef MSHADOW_USE_F16C 140 #if defined(_MSC_VER) || defined(__CUDACC__) 141 #define MSHADOW_USE_F16C 0 142 #elif defined(__clang__) && \ 143 ((__clang_major__ < 8) || ((__clang_major__ == 8) && (__clang_minor__ < 1))) 144 #define MSHADOW_USE_F16C 0 146 #define MSHADOW_USE_F16C 1 151 #ifndef MSHADOW_USE_NVML 152 #define MSHADOW_USE_NVML 0 156 #undef MSHADOW_USE_SSE 157 #define MSHADOW_USE_SSE 0 160 #if MSHADOW_USE_CBLAS 164 #elif MSHADOW_USE_MKL 165 #include <mkl_blas.h> 166 #include <mkl_cblas.h> 168 #include <mkl_vsl_functions.h> 169 #include <mkl_version.h> 174 #include <cublas_v2.h> 178 #if MSHADOW_USE_CUDNN == 1 182 #if MSHADOW_USE_CUSOLVER == 1 183 #include <cusolverDn.h> 192 #ifdef MSHADOW_XINLINE 193 #error "MSHADOW_XINLINE must not be defined" 196 #define MSHADOW_FORCE_INLINE __forceinline 197 #pragma warning(disable : 4068) 199 #define MSHADOW_FORCE_INLINE inline __attribute__((always_inline)) 202 #define MSHADOW_XINLINE MSHADOW_FORCE_INLINE __device__ __host__ 204 #define MSHADOW_XINLINE MSHADOW_FORCE_INLINE 207 #define MSHADOW_CINLINE MSHADOW_FORCE_INLINE 209 #if defined(__GXX_EXPERIMENTAL_CXX0X) ||\ 210 defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L 211 #define MSHADOW_CONSTEXPR constexpr 213 #define MSHADOW_CONSTEXPR const 222 #ifndef MSHADOW_DEFAULT_DTYPE 223 #define MSHADOW_DEFAULT_DTYPE = ::mshadow::default_real_t 229 #ifndef MSHADOW_USE_GLOG 230 #define MSHADOW_USE_GLOG DMLC_USE_GLOG 231 #endif // MSHADOW_USE_GLOG 234 #define MSHADOW_THROW_EXCEPTION noexcept(false) 235 #define MSHADOW_NO_EXCEPTION noexcept(true) 237 #define MSHADOW_THROW_EXCEPTION 238 #define MSHADOW_NO_EXCEPTION 241 #if defined(_MSC_VER) 242 #define MSHADOW_ALIGNED(x) __declspec(align(x)) 244 #define MSHADOW_ALIGNED(x) __attribute__ ((aligned(x))) 252 #define MSHADOW_CUDA_CALL(func) \ 254 cudaError_t e = (func); \ 255 if (e == cudaErrorCudartUnloading) { \ 256 throw dmlc::Error(cudaGetErrorString(e)); \ 258 CHECK(e == cudaSuccess) \ 259 << "CUDA: " << cudaGetErrorString(e); \ 266 #define MSHADOW_CATCH_ERROR(func) \ 270 } catch (const dmlc::Error &e) { \ 271 std::string what = e.what(); \ 272 if (what.find("driver shutting down") == std::string::npos) { \ 273 LOG(ERROR) << "Ignore CUDA Error " << what; \ 280 #include "./logging.h" 286 const float kPi = 3.1415926f;
288 #if MSHADOW_INT64_TENSOR_SIZE == 1 317 template<
typename DType>
323 static const int kLanes = 1;
325 #if (CUDA_VERSION >= 8000) 326 static const cudaDataType_t kCudaFlag = CUDA_R_32F;
328 #if MSHADOW_USE_CUDNN 329 static const cudnnDataType_t kCudnnFlag = CUDNN_DATA_FLOAT;
330 typedef float ScaleType;
337 static const int kLanes = 1;
339 #if (CUDA_VERSION >= 8000) 340 static const cudaDataType_t kCudaFlag = CUDA_R_64F;
342 #if MSHADOW_USE_CUDNN 343 static const cudnnDataType_t kCudnnFlag = CUDNN_DATA_DOUBLE;
344 typedef double ScaleType;
351 static const int kLanes = 1;
353 #if (CUDA_VERSION >= 8000) 354 static const cudaDataType_t kCudaFlag = CUDA_R_16F;
356 #if MSHADOW_USE_CUDNN 357 static const cudnnDataType_t kCudnnFlag = CUDNN_DATA_HALF;
358 typedef float ScaleType;
365 static const int kLanes = 2;
370 static const int kLanes = 1;
372 #if (CUDA_VERSION >= 8000) 373 static const cudaDataType_t kCudaFlag = CUDA_R_8U;
375 #if (MSHADOW_USE_CUDNN == 1 && CUDNN_MAJOR >= 6) 377 static const cudnnDataType_t kCudnnFlag = CUDNN_DATA_INT8;
378 typedef uint8_t ScaleType;
385 static const int kLanes = 1;
387 #if (CUDA_VERSION >= 8000) 388 static const cudaDataType_t kCudaFlag = CUDA_R_8I;
390 #if (MSHADOW_USE_CUDNN == 1 && CUDNN_MAJOR >= 6) 391 static const cudnnDataType_t kCudnnFlag = CUDNN_DATA_INT8;
392 typedef int8_t ScaleType;
399 static const int kLanes = 1;
401 #if (CUDA_VERSION >= 8000) 402 static const cudaDataType_t kCudaFlag = CUDA_R_32I;
404 #if (MSHADOW_USE_CUDNN == 1 && CUDNN_MAJOR >= 6) 405 static const cudnnDataType_t kCudnnFlag = CUDNN_DATA_INT32;
406 typedef int32_t ScaleType;
413 static const int kLanes = 1;
418 static const int kLanes = 1;
444 static const index_t kNdim = 4;
445 #if (MSHADOW_USE_CUDA && MSHADOW_USE_CUDNN == 1 && CUDNN_MAJOR >= 4) 446 static const cudnnTensorFormat_t kCudnnFlag = CUDNN_TENSOR_NCHW;
448 static const int kCudnnFlag = -1;
454 static const index_t kNdim = 4;
455 #if (MSHADOW_USE_CUDA && MSHADOW_USE_CUDNN == 1 && CUDNN_MAJOR >= 4) 456 static const cudnnTensorFormat_t kCudnnFlag = CUDNN_TENSOR_NHWC;
458 static const int kCudnnFlag = -1;
467 static const index_t kNdim = 5;
468 #if (MSHADOW_USE_CUDA && MSHADOW_USE_CUDNN == 1 && CUDNN_MAJOR >= 4) 469 static const cudnnTensorFormat_t kCudnnFlag = CUDNN_TENSOR_NCHW;
471 static const int kCudnnFlag = -1;
477 static const index_t kNdim = 5;
478 #if (MSHADOW_USE_CUDA && MSHADOW_USE_CUDNN == 1 && CUDNN_MAJOR >= 4) 479 static const cudnnTensorFormat_t kCudnnFlag = CUDNN_TENSOR_NHWC;
481 static const int kCudnnFlag = -1;
494 template<
typename DType>
502 template<
typename DType>
510 template<
typename DType>
518 template<
typename DType>
526 template<
typename DType>
538 template<
typename DType>
549 template<
typename DType>
554 inline static default_real_t
AlphaBLAS(
void) {
return 1.0f; }
556 inline static default_real_t
BetaBLAS(
void) {
return 0.0f; }
563 template<
typename DType>
568 inline static default_real_t
AlphaBLAS(
void) {
return 1.0f; }
570 inline static default_real_t
BetaBLAS(
void) {
return 1.0f; }
577 template<
typename DType>
582 inline static default_real_t
AlphaBLAS(
void) {
return -1.0f; }
584 inline static default_real_t
BetaBLAS(
void) {
return 1.0f; }
591 template<
typename DType>
601 template<
typename DType>
610 #ifndef __CUDA_ARCH__ 618 namespace isnan_typed {
619 template<
typename DType>
644 namespace isinf_typed {
645 template<
typename DType>
674 template<
typename DType>
721 template<
typename DType>
723 return MinValue<DType>();
738 return half::half_t::Binary(
746 template<
typename DType>
793 template<
typename DType>
795 return MaxValue<DType>();
818 template<
typename DType>
823 template<
typename DType>
825 DType y = src - residual;
830 residual = (t - dst) - y;
835 template<
typename DType>
837 Reduce(dst_val, src_val);
840 template<
typename DType>
841 MSHADOW_XINLINE static void Merge(
volatile DType& dst_val,
volatile DType& dst_residual,
volatile DType& src_val,
volatile DType& src_residual) {
842 DType t1 = dst_val + src_val;
847 DType e = t1 - dst_val;
848 DType t2 = ((src_val - e) + (dst_val - (t1 - e))) + dst_residual + src_residual;
850 dst_residual = t2 - (dst_val - t1);
854 template<
typename DType>
857 template<
typename DType>
863 template<
typename DType>
870 template<
typename DType>
877 template<
typename DType>
886 template<
typename DType>
889 if (!(dst >= src)) dst = src;
893 template<
typename DType>
898 template<
typename DType>
900 Reduce(dst_val, src_val);
903 template<
typename DType>
904 MSHADOW_XINLINE static void Merge(
volatile DType& dst_val,
volatile DType& dst_residual,
volatile DType& src_val,
volatile DType& src_residual) {
905 Reduce(dst_val, src_val);
908 template<
typename DType>
911 template<
typename DType>
917 template<
typename DType>
919 return redres == redsrc ? 1: 0;
924 template<
typename DType>
926 initv = limits::NegInfValue<DType>();
931 template<
typename DType>
939 template<
typename DType>
942 if (!(dst <= src)) dst = src;
946 template<
typename DType>
951 template<
typename DType>
953 Reduce(dst_val, src_val);
956 template<
typename DType>
957 MSHADOW_XINLINE static void Merge(
volatile DType& dst_val,
volatile DType& dst_residual,
volatile DType& src_val,
volatile DType& src_residual) {
958 Reduce(dst_val, src_val);
961 template<
typename DType>
964 template<
typename DType>
970 template<
typename DType>
972 return redres == redsrc ? 1: 0;
977 template<
typename DType>
979 initv = limits::PosInfValue<DType>();
984 template<
typename DType>
991 #define MSHADOW_TYPE_SWITCH(type, DType, ...) \ 993 case mshadow::kFloat32: \ 995 typedef float DType; \ 999 case mshadow::kFloat64: \ 1001 typedef double DType; \ 1005 case mshadow::kFloat16: \ 1007 typedef mshadow::half::half_t DType; \ 1011 case mshadow::kUint8: \ 1013 typedef uint8_t DType; \ 1017 case mshadow::kInt8: \ 1019 typedef int8_t DType; \ 1023 case mshadow::kInt32: \ 1025 typedef int32_t DType; \ 1029 case mshadow::kInt64: \ 1031 typedef int64_t DType; \ 1036 LOG(FATAL) << "Unknown type enum " << type; \ 1039 #define MSHADOW_TYPE_SWITCH_WITH_HALF2(type, DType, ...) \ 1041 case mshadow::kFloat32: \ 1043 typedef float DType; \ 1047 case mshadow::kFloat64: \ 1049 typedef double DType; \ 1053 case mshadow::kFloat16: \ 1055 typedef mshadow::half::half2_t DType; \ 1059 case mshadow::kUint8: \ 1061 typedef uint8_t DType; \ 1065 case mshadow::kInt32: \ 1067 typedef int32_t DType; \ 1071 case mshadow::kInt64: \ 1073 typedef int64_t DType; \ 1078 LOG(FATAL) << "Unknown type enum " << type; \ 1081 #define MSHADOW_SGL_DBL_TYPE_SWITCH(type, DType, ...) \ 1083 case mshadow::kFloat32: \ 1085 typedef float DType; \ 1089 case mshadow::kFloat64: \ 1091 typedef double DType; \ 1096 LOG(FATAL) << "This operation only supports " \ 1097 "32-bit and 64-bit floating point"; \ 1100 #define MSHADOW_REAL_TYPE_SWITCH(type, DType, ...) \ 1102 case mshadow::kFloat32: \ 1104 typedef float DType; \ 1108 case mshadow::kFloat64: \ 1110 typedef double DType; \ 1114 case mshadow::kFloat16: \ 1116 typedef mshadow::half::half_t DType; \ 1120 case mshadow::kUint8: \ 1121 LOG(FATAL) << "This operation only support " \ 1122 "floating point types not uint8"; \ 1124 case mshadow::kInt8: \ 1125 LOG(FATAL) << "This operation only support " \ 1126 "floating point types not int8"; \ 1128 case mshadow::kInt32: \ 1129 LOG(FATAL) << "This operation only support " \ 1130 "floating point types, not int32";\ 1132 case mshadow::kInt64: \ 1133 LOG(FATAL) << "This operation only support " \ 1134 "floating point types, not int64";\ 1137 LOG(FATAL) << "Unknown type enum " << type; \ 1140 #define MSHADOW_REAL_TYPE_SWITCH_EX(type$, DType$, DLargeType$, ...) \ 1142 case mshadow::kFloat32: \ 1144 typedef float DType$; \ 1145 typedef float DLargeType$; \ 1149 case mshadow::kFloat64: \ 1151 typedef double DType$; \ 1152 typedef double DLargeType$; \ 1156 case mshadow::kFloat16: \ 1158 typedef mshadow::half::half_t DType$; \ 1159 typedef float DLargeType$; \ 1163 case mshadow::kUint8: \ 1164 LOG(FATAL) << "This operation only support " \ 1165 "floating point types not uint8"; \ 1167 case mshadow::kInt8: \ 1168 LOG(FATAL) << "This operation only support " \ 1169 "floating point types not int8"; \ 1171 case mshadow::kInt32: \ 1172 LOG(FATAL) << "This operation only support " \ 1173 "floating point types, not int32";\ 1175 case mshadow::kInt64: \ 1176 LOG(FATAL) << "This operation only support " \ 1177 "floating point types, not int64";\ 1180 LOG(FATAL) << "Unknown type enum " << type$; \ 1183 #define MSHADOW_LAYOUT_SWITCH(layout, Layout, ...) \ 1185 case mshadow::kNCHW: \ 1187 const int Layout = kNCHW; \ 1191 case mshadow::kNHWC: \ 1193 const int Layout = kNHWC; \ 1197 case mshadow::kNCDHW: \ 1199 const int Layout = kNCDHW; \ 1203 case mshadow::kNDHWC: \ 1205 const int Layout = kNDHWC; \ 1210 LOG(FATAL) << "Unknown layout enum " << layout; \ 1217 #define MSHADOW_IDX_TYPE_SWITCH(type, DType, ...) \ 1219 case mshadow::kInt64: \ 1221 typedef int64_t DType; \ 1226 LOG(FATAL) << "Unknown type enum " << type; \ 1229 #define MSHADOW_TYPE_SWITCH_WITH_BOOL(type, DType, ...) \ 1231 case mshadow::kFloat32: \ 1233 typedef float DType; \ 1237 case mshadow::kFloat64: \ 1239 typedef double DType; \ 1243 case mshadow::kFloat16: \ 1245 typedef mshadow::half::half_t DType; \ 1249 case mshadow::kUint8: \ 1251 typedef uint8_t DType; \ 1255 case mshadow::kInt8: \ 1257 typedef int8_t DType; \ 1261 case mshadow::kInt32: \ 1263 typedef int32_t DType; \ 1267 case mshadow::kInt64: \ 1269 typedef int64_t DType; \ 1273 case mshadow::kBool: \ 1275 typedef bool DType; \ 1280 LOG(FATAL) << "Unknown type enum " << type; \ 1291 #endif // MSHADOW_BASE_H_ static MSHADOW_XINLINE void Finalize(volatile DType &dst, volatile DType &residual)
finalize reduction
Definition: base.h:965
#define MSHADOW_TYPE_SWITCH_WITH_BOOL(type, DType,...)
Definition: base.h:1229
static MSHADOW_XINLINE DType PartialGrad(DType redres, DType redsrc)
calculate gradient of redres with respect to redsrc, redres: reduced result, redsrc: one of reduction...
Definition: base.h:971
const int default_type_flag
type enum value for default real type
Definition: base.h:422
static MSHADOW_XINLINE void Finalize(volatile DType &dst, volatile DType &residual)
finalize reduction
Definition: base.h:912
MSHADOW_XINLINE DType MaxValue(void)
maximum value of certain types
MSHADOW_XINLINE int8_t MaxValue< int8_t >(void)
maximum value of int8_t
Definition: base.h:770
static default_real_t BetaBLAS(void)
helper constant to use BLAS, beta
Definition: base.h:584
MSHADOW_XINLINE float NegInfValue< float >(void)
negative infinity value of float
Definition: base.h:727
static MSHADOW_XINLINE void Save(DType &a, DType b)
save b to a using save method
Definition: base.h:564
MSHADOW_XINLINE int MinValue< int32_t >(void)
minimum value of int32_t
Definition: base.h:703
static MSHADOW_XINLINE void Save(DType &a, DType b)
save b to a using save method
Definition: base.h:578
MSHADOW_XINLINE float MinValue< float >(void)
minimum value of float
Definition: base.h:678
definition of vector float16, half2 type.
static MSHADOW_XINLINE DType PartialGrad(DType redres, DType redsrc)
calculate gradient of redres with respect to redsrc, redres: reduced result, redsrc: one of reduction...
Definition: base.h:864
static MSHADOW_XINLINE void SetInitValue(DType &initv, DType &residual)
set the initial value during reduction
Definition: base.h:878
save to saver: =
Definition: base.h:547
MSHADOW_XINLINE uint8_t MinValue< uint8_t >(void)
minimum value of uint8_t
Definition: base.h:693
MSHADOW_XINLINE bool IsInf(volatile DType val)
Definition: base.h:646
definition of half (float16) type.
static MSHADOW_XINLINE DType PartialGrad(DType redres, DType redsrc)
calculate gradient of redres with respect to redsrc, redres: reduced result, redsrc: one of reduction...
Definition: base.h:918
static MSHADOW_XINLINE void Reduce(volatile DType &dst, volatile DType src, volatile DType &none)
do reduction into dst
Definition: base.h:894
#define MSHADOW_HALF_EXPONENT_BITS
Definition: half.h:353
divide operator
Definition: base.h:516
MSHADOW_XINLINE DType NegInfValue(void)
negative infinity of certain types
Definition: base.h:722
static MSHADOW_XINLINE void Save(DType &a, DType b)
save b to a using save method
Definition: base.h:592
MSHADOW_XINLINE float PosInfValue< float >(void)
positive infinity value of float
Definition: base.h:799
static MSHADOW_XINLINE void SetInitValue(DType &initv)
set the initial value during reduction
Definition: base.h:871
op::right OPType
corresponding binary operator type
Definition: base.h:558
op::minus OPType
corresponding binary operator type
Definition: base.h:586
static MSHADOW_XINLINE DType Map(DType a, DType b)
map a, b to result using defined operation
Definition: base.h:519
MSHADOW_XINLINE bool IsNan(volatile mshadow::half::half_t val)
Definition: base.h:636
static MSHADOW_XINLINE void SetInitValue(DType &initv, DType &none)
set the initial value during reduction
Definition: base.h:932
static MSHADOW_XINLINE void Reduce(volatile DType &dst, volatile DType src)
do reduction into dst
Definition: base.h:940
static MSHADOW_XINLINE void Reduce(volatile DType &dst, volatile DType src)
do reduction into dst
Definition: base.h:887
identity function that maps a real number to it self
Definition: base.h:536
op::mul OPType
corresponding binary operator type
Definition: base.h:596
static MSHADOW_XINLINE void Save(DType &a, DType b)
save b to a using save method
Definition: base.h:550
static default_real_t AlphaBLAS(void)
helper constant to use BLAS, alpha
Definition: base.h:582
static MSHADOW_XINLINE void Finalize(volatile DType &dst, volatile DType &residual)
finalize reduction
Definition: base.h:858
MSHADOW_XINLINE int8_t MinValue< int8_t >(void)
minimum value of int8_t
Definition: base.h:698
static MSHADOW_XINLINE void Finalize(volatile DType &dst)
finalize reduction
Definition: base.h:909
MSHADOW_XINLINE bool IsInf(volatile mshadow::half::half_t val)
Definition: base.h:662
MSHADOW_XINLINE bool MinValue< bool >(void)
minimum value of bool
Definition: base.h:713
#define MSHADOW_XINLINE
Definition: base.h:204
static MSHADOW_XINLINE void Reduce(volatile DType &dst, volatile DType src, volatile DType &residual)
do stable reduction into dst
Definition: base.h:824
static MSHADOW_XINLINE void Save(DType &a, DType b)
save b to a using save method
Definition: base.h:602
const unsigned kRandBufferSize
buffer size for each random number generator
Definition: base.h:284
MSHADOW_XINLINE double MaxValue< double >(void)
maximum value of double
Definition: base.h:755
MSHADOW_XINLINE bool IsNan(volatile DType val)
Definition: base.h:620
const int default_layout
default layout for 4d tensor
Definition: base.h:463
static MSHADOW_XINLINE void SetInitValue(DType &initv, DType &none)
set the initial value during reduction
Definition: base.h:985
LayoutFlag
Definition: base.h:425
get rhs
Definition: base.h:524
minus to saver: -=
Definition: base.h:575
MSHADOW_XINLINE int MaxValue< int32_t >(void)
maximum value of int32_t
Definition: base.h:775
int32_t index_t
type that will be used for index
Definition: base.h:291
multiply to saver: *=
Definition: base.h:589
static MSHADOW_XINLINE DType Map(DType a, DType b)
map a, b to result using defined operation
Definition: base.h:503
const float kPi
pi
Definition: base.h:286
op::plus OPType
corresponding binary operator type
Definition: base.h:572
MSHADOW_XINLINE float MaxValue< float >(void)
maximum value of float
Definition: base.h:750
float default_real_t
float point type that will be used in default by mshadow
Definition: base.h:303
const int default_layout_5d
default layout for 5d tensor
Definition: base.h:486
static MSHADOW_XINLINE void Reduce(volatile DType &dst, volatile DType src, volatile DType &none)
do reduction into dst
Definition: base.h:947
MSHADOW_XINLINE int64_t MinValue< int64_t >(void)
minimum value of int64_t
Definition: base.h:708
minimum reducer
Definition: base.h:937
MSHADOW_XINLINE double MinValue< double >(void)
minimum value of double
Definition: base.h:683
#define MSHADOW_HALF_MIN
overloaded + operator for half_t
Definition: half.h:350
MSHADOW_XINLINE DType MinValue(void)
minimum value of certain types
divide to saver: /=
Definition: base.h:599
static MSHADOW_XINLINE DType Map(DType a, DType b)
map a, b to result using defined operation
Definition: base.h:495
static MSHADOW_XINLINE void Finalize(volatile DType &dst)
finalize reduction
Definition: base.h:962
MSHADOW_XINLINE DType PosInfValue(void)
positive infinity of certain types
Definition: base.h:794
size_t mshadow_sizeof(int type)
get data type size from type enum
Definition: base.h:1284
static MSHADOW_XINLINE void Merge(volatile DType &dst_val, volatile DType &src_val)
combine the results of two reducers
Definition: base.h:899
MSHADOW_XINLINE double NegInfValue< double >(void)
negative infinity value of double
Definition: base.h:732
static MSHADOW_XINLINE DType Map(DType a)
map a to result using defined operation
Definition: base.h:539
maximum reducer
Definition: base.h:884
static MSHADOW_XINLINE void Merge(volatile DType &dst_val, volatile DType &dst_residual, volatile DType &src_val, volatile DType &src_residual)
combine the results of two reducers
Definition: base.h:841
TypeFlag
data type flag
Definition: base.h:306
MSHADOW_XINLINE int64_t MaxValue< int64_t >(void)
maximum value of int64_t
Definition: base.h:780
static MSHADOW_XINLINE DType Map(DType a, DType b)
map a, b to result using defined operation
Definition: base.h:511
plus operator
Definition: base.h:500
static default_real_t AlphaBLAS(void)
helper constant to use BLAS, alpha
Definition: base.h:554
save to saver: +=
Definition: base.h:561
static MSHADOW_XINLINE void Merge(volatile DType &dst_val, volatile DType &dst_residual, volatile DType &src_val, volatile DType &src_residual)
combine the results of two reducers
Definition: base.h:957
sum reducer
Definition: base.h:816
static MSHADOW_XINLINE void Merge(volatile DType &dst_val, volatile DType &src_val)
combine the results of two reducers
Definition: base.h:836
static default_real_t BetaBLAS(void)
helper constant to use BLAS, beta
Definition: base.h:570
static MSHADOW_XINLINE void SetInitValue(DType &initv)
set the initial value during reduction
Definition: base.h:925
mul operator
Definition: base.h:492
#define MSHADOW_HALF_SIGN_BIT
Definition: half.h:352
#define MSHADOW_HALF_MAX
Definition: half.h:351
static default_real_t BetaBLAS(void)
helper constant to use BLAS, beta
Definition: base.h:556
namespace for mshadow
Definition: base.h:282
static MSHADOW_XINLINE void SetInitValue(DType &initv)
set the initial value during reduction
Definition: base.h:978
MSHADOW_XINLINE bool MaxValue< bool >(void)
maximum value of bool
Definition: base.h:785
static MSHADOW_XINLINE void Reduce(volatile DType &dst, volatile DType src)
do reduction into dst
Definition: base.h:819
MSHADOW_XINLINE uint8_t MaxValue< uint8_t >(void)
maximum value of uint8_t
Definition: base.h:765
static MSHADOW_XINLINE DType Map(DType a, DType b)
map a, b to result using defined operation
Definition: base.h:527
static MSHADOW_XINLINE void Merge(volatile DType &dst_val, volatile DType &src_val)
combine the results of two reducers
Definition: base.h:952
static MSHADOW_XINLINE void Merge(volatile DType &dst_val, volatile DType &dst_residual, volatile DType &src_val, volatile DType &src_residual)
combine the results of two reducers
Definition: base.h:904
static MSHADOW_XINLINE void Finalize(volatile DType &dst)
finalize reduction
Definition: base.h:855
static default_real_t AlphaBLAS(void)
helper constant to use BLAS, alpha
Definition: base.h:568
index_t openmp_index_t
openmp index for linux
Definition: base.h:299
minus operator
Definition: base.h:508
MSHADOW_XINLINE double PosInfValue< double >(void)
positive infinity value of double
Definition: base.h:804
op::div OPType
corresponding binary operator type
Definition: base.h:606