@@ -225,10 +225,10 @@ struct MultiSGDKernelParam {
225
225
template <typename MPDType, bool has_momentum, bool has_mixed_precision>
226
226
struct MultiSGDKernel {
227
227
template <typename DType>
228
- MSHADOW_XINLINE static void Map (int i, const MultiSGDKernelParam<DType, MPDType>& param,
228
+ MSHADOW_XINLINE static void Map (index_t i, const MultiSGDKernelParam<DType, MPDType>& param,
229
229
const OpReqType req) {
230
230
for (int index = 0 ; index < param.count ; ++index ) {
231
- if (( size_t ) i < param.sizes [index ]) {
231
+ if (i < static_cast < index_t >( param.sizes [index ]) ) {
232
232
MPDType w = has_mixed_precision ? param.weights32 [index ][i] :
233
233
MPDType (param.weights [index ][i]);
234
234
MPDType mom = has_momentum ? param.mom [index ][i] : MPDType (0 );
@@ -381,7 +381,7 @@ inline void MultiSGDMomUpdate(const nnvm::NodeAttrs& attrs,
381
381
382
382
struct SGDKernel {
383
383
template <typename DType>
384
- MSHADOW_XINLINE static void Map (int i, DType* out_data, const DType* weight_data,
384
+ MSHADOW_XINLINE static void Map (index_t i, DType* out_data, const DType* weight_data,
385
385
const DType* grad_data, const DType param_clip_gradient,
386
386
const DType param_lr, const DType param_wd, const DType param_rescale_grad,
387
387
const OpReqType req) {
@@ -429,9 +429,9 @@ struct SGDDnsRspKernel<req, gpu> {
429
429
// IType is row sparse idx type
430
430
// i is the ith element in row sparse gradient
431
431
template <typename DType, typename IType>
432
- MSHADOW_XINLINE static void Map (int i, const index_t row_length, DType* out, const DType* weight ,
433
- const IType* grad_idx , const DType *grad_val ,
434
- const DType clip_gradient, const DType lr,
432
+ MSHADOW_XINLINE static void Map (index_t i, const index_t row_length, DType* out,
433
+ const DType* weight , const IType* grad_idx ,
434
+ const DType *grad_val, const DType clip_gradient, const DType lr,
435
435
const DType wd, const DType rescale_grad) {
436
436
using nnvm::dim_t ;
437
437
using namespace mshadow_op ;
@@ -457,9 +457,9 @@ struct SGDDnsRspKernel<req, cpu> {
457
457
// IType is row sparse idx type
458
458
// i is the ith row in row sparse gradient
459
459
template <typename DType, typename IType>
460
- MSHADOW_XINLINE static void Map (int i, const index_t row_length, DType* out, const DType* weight ,
461
- const IType* grad_idx , const DType *grad_val ,
462
- const DType clip_gradient, const DType lr,
460
+ MSHADOW_XINLINE static void Map (index_t i, const index_t row_length, DType* out,
461
+ const DType* weight , const IType* grad_idx ,
462
+ const DType *grad_val, const DType clip_gradient, const DType lr,
463
463
const DType wd, const DType rescale_grad) {
464
464
for (index_t j = 0 ; j < row_length; j++) {
465
465
index_t data_i = grad_idx[i] * row_length + j;
@@ -600,10 +600,11 @@ struct SGDMomParam : public dmlc::Parameter<SGDMomParam> {
600
600
601
601
struct SGDMomKernel {
602
602
template <typename DType>
603
- MSHADOW_XINLINE static void Map (int i, DType* out_data, DType* mom_data, const DType* weight_data,
604
- const DType* grad_data, const DType param_clip_gradient, const DType param_momentum,
605
- const DType param_lr, const DType param_wd, const DType param_rescale_grad,
606
- const OpReqType req) {
603
+ MSHADOW_XINLINE static void Map (index_t i, DType* out_data, DType* mom_data,
604
+ const DType* weight_data, const DType* grad_data,
605
+ const DType param_clip_gradient, const DType param_momentum,
606
+ const DType param_lr, const DType param_wd,
607
+ const DType param_rescale_grad, const OpReqType req) {
607
608
if (param_clip_gradient >= 0 .0f ) {
608
609
mom_data[i] = param_momentum*mom_data[i]
609
610
- param_lr*param_wd*weight_data[i]
@@ -654,7 +655,7 @@ inline bool MP_InferType(const nnvm::NodeAttrs& attrs,
654
655
655
656
struct MP_SGDKernel {
656
657
template <typename DType>
657
- MSHADOW_XINLINE static void Map (int i, DType* out_data, const DType* weight_data,
658
+ MSHADOW_XINLINE static void Map (index_t i, DType* out_data, const DType* weight_data,
658
659
const DType* grad_data, float * weight32, const float param_clip_gradient,
659
660
const float param_lr, const float param_wd, const float param_rescale_grad,
660
661
const OpReqType req) {
@@ -698,7 +699,7 @@ inline void MP_SGDUpdate(const nnvm::NodeAttrs& attrs,
698
699
699
700
struct MP_SGDMomKernel {
700
701
template <typename DType>
701
- MSHADOW_XINLINE static void Map (int i, DType* out_data, float * mom_data,
702
+ MSHADOW_XINLINE static void Map (index_t i, DType* out_data, float * mom_data,
702
703
const DType* weight_data, const DType* grad_data, float * weight32,
703
704
const float param_clip_gradient, const float param_momentum, const float param_lr,
704
705
const float param_wd, const float param_rescale_grad, const OpReqType req) {
@@ -749,7 +750,7 @@ struct SGDMomDnsRspDnsKernel;
749
750
template <int req>
750
751
struct SGDMomDnsRspDnsKernel <req, cpu> {
751
752
template <typename DType, typename IType>
752
- MSHADOW_XINLINE static void Map (int i, index_t row_length, DType* out_data,
753
+ MSHADOW_XINLINE static void Map (index_t i, index_t row_length, DType* out_data,
753
754
DType* mom_data, const DType* weight_data, const IType* grad_idx,
754
755
const DType* grad_data, const DType clip_gradient, const DType momentum,
755
756
const DType lr, const DType wd, const DType rescale_grad) {
@@ -776,7 +777,7 @@ struct SGDMomDnsRspDnsKernel<req, cpu> {
776
777
template <int req>
777
778
struct SGDMomDnsRspDnsKernel <req, gpu> {
778
779
template <typename DType, typename IType>
779
- MSHADOW_XINLINE static void Map (int i, index_t row_length, DType* out_data,
780
+ MSHADOW_XINLINE static void Map (index_t i, index_t row_length, DType* out_data,
780
781
DType* mom_data, const DType* weight_data, const IType* grad_idx,
781
782
const DType* grad_data, const DType clip_gradient, const DType momentum,
782
783
const DType lr, const DType wd, const DType rescale_grad) {
@@ -1060,7 +1061,7 @@ struct NAGMomParam : public dmlc::Parameter<NAGMomParam> {
1060
1061
1061
1062
struct NAGMomKernel {
1062
1063
template <typename DType>
1063
- MSHADOW_XINLINE static void Map (int i, DType* out_data, DType* mom_data,
1064
+ MSHADOW_XINLINE static void Map (index_t i, DType* out_data, DType* mom_data,
1064
1065
const DType* weight_data, const DType* grad_data,
1065
1066
const DType param_clip_gradient, const DType param_momentum,
1066
1067
const DType param_lr, const DType param_wd,
@@ -1107,7 +1108,7 @@ inline void NAGMomUpdate(const nnvm::NodeAttrs& attrs,
1107
1108
1108
1109
struct MP_NAGMomKernel {
1109
1110
template <typename DType>
1110
- MSHADOW_XINLINE static void Map (int i, DType* out_data,
1111
+ MSHADOW_XINLINE static void Map (index_t i, DType* out_data,
1111
1112
float * mom_data, const DType* weight_data,
1112
1113
const DType* grad_data, float * weight32,
1113
1114
const float param_clip_gradient,
@@ -1204,7 +1205,7 @@ struct FTMLParam : public dmlc::Parameter<FTMLParam> {
1204
1205
1205
1206
struct FTMLKernel {
1206
1207
template <typename DType>
1207
- MSHADOW_XINLINE static void Map (int i, DType* out, DType* weight, DType* grad,
1208
+ MSHADOW_XINLINE static void Map (index_t i, DType* out, DType* weight, DType* grad,
1208
1209
DType* d, DType* v, DType* z, const DType lr, const DType beta1,
1209
1210
const DType beta2, const DType epsilon, const DType t,
1210
1211
const DType wd, const DType rescale_grad, const DType clip_grad,
@@ -1291,7 +1292,7 @@ struct AdamParam : public dmlc::Parameter<AdamParam> {
1291
1292
1292
1293
struct AdamUpdateKernel {
1293
1294
template <typename DType>
1294
- MSHADOW_XINLINE static void Map (int i, DType* out_data,
1295
+ MSHADOW_XINLINE static void Map (index_t i, DType* out_data,
1295
1296
DType* mean_data, DType* var_data, const DType* weight_data, const DType* grad_data,
1296
1297
const DType clip_gradient, const DType rescale_grad,
1297
1298
const DType beta1, const DType beta2,
@@ -1350,7 +1351,7 @@ struct AdamDnsRspDnsKernel;
1350
1351
template <int req>
1351
1352
struct AdamDnsRspDnsKernel <req, cpu> {
1352
1353
template <typename DType, typename IType>
1353
- MSHADOW_XINLINE static void Map (int i, const nnvm::dim_t row_length, DType* out_data,
1354
+ MSHADOW_XINLINE static void Map (index_t i, const nnvm::dim_t row_length, DType* out_data,
1354
1355
DType* mean_data, DType* var_data, const DType* weight_data, const IType* grad_idx,
1355
1356
const DType* grad_data, const DType clip_gradient, const DType beta1, const DType beta2,
1356
1357
const DType lr, const DType wd, const DType epsilon, const DType rescale_grad) {
@@ -1383,7 +1384,7 @@ struct AdamDnsRspDnsKernel<req, cpu> {
1383
1384
template <int req>
1384
1385
struct AdamDnsRspDnsKernel <req, gpu> {
1385
1386
template <typename DType, typename IType>
1386
- MSHADOW_XINLINE static void Map (int i, const nnvm::dim_t row_length, DType* out_data,
1387
+ MSHADOW_XINLINE static void Map (index_t i, const nnvm::dim_t row_length, DType* out_data,
1387
1388
DType* mean_data, DType* var_data, const DType* weight_data, const IType* grad_idx,
1388
1389
const DType* grad_data, const DType clip_gradient, const DType beta1, const DType beta2,
1389
1390
const DType lr, const DType wd, const DType epsilon, const DType rescale_grad) {
@@ -1620,7 +1621,7 @@ struct LambUpdatePhaseTwoParam : public dmlc::Parameter<LambUpdatePhaseTwoParam>
1620
1621
1621
1622
struct LambUpdatePhaseOneKernel {
1622
1623
template <typename DType>
1623
- MSHADOW_XINLINE static void Map (int i, DType* out_data,
1624
+ MSHADOW_XINLINE static void Map (index_t i, DType* out_data,
1624
1625
DType* mean_data, DType* var_data, const DType* weight_data, const DType* grad_data,
1625
1626
const DType clip_gradient, const DType rescale_grad,
1626
1627
const DType beta1, const DType beta1_t , const DType beta2, const DType beta2_t ,
@@ -1704,7 +1705,7 @@ inline bool LambUpdatePhaseTwoShape(const nnvm::NodeAttrs& attrs,
1704
1705
1705
1706
struct LambUpdatePhaseTwoKernel {
1706
1707
template <typename DType>
1707
- MSHADOW_XINLINE static void Map (int i, DType* out_data,
1708
+ MSHADOW_XINLINE static void Map (index_t i, DType* out_data,
1708
1709
const DType* weight_data, const DType* g,
1709
1710
const DType* r1, const DType* r2,
1710
1711
DType lr, const DType lower_bound,
@@ -1771,7 +1772,7 @@ inline bool MPLambPhaseOneType(const nnvm::NodeAttrs& attrs,
1771
1772
1772
1773
struct MPLambUpdatePhaseOneKernel {
1773
1774
template <typename DType>
1774
- MSHADOW_XINLINE static void Map (int i, float * out_data,
1775
+ MSHADOW_XINLINE static void Map (index_t i, float * out_data,
1775
1776
float * mean_data, float * var_data, const DType* weight_data,
1776
1777
const DType* grad_data, const float * weight32_data,
1777
1778
const float clip_gradient, const float rescale_grad,
@@ -1861,7 +1862,7 @@ inline bool MPLambUpdatePhaseTwoShape(const nnvm::NodeAttrs& attrs,
1861
1862
1862
1863
struct MPLambUpdatePhaseTwoKernel {
1863
1864
template <typename DType>
1864
- MSHADOW_XINLINE static void Map (int i, DType* out_data,
1865
+ MSHADOW_XINLINE static void Map (index_t i, DType* out_data,
1865
1866
const DType* weight_data, const float * g,
1866
1867
const float * r1, const float * r2, const float * weight32_data,
1867
1868
float lr, const float lower_bound,
@@ -1952,7 +1953,7 @@ struct RMSPropAlexParam : public dmlc::Parameter<RMSPropAlexParam> {
1952
1953
1953
1954
struct RMSPropAlexUpdateKernel {
1954
1955
template <typename DType>
1955
- MSHADOW_XINLINE static void Map (int i, DType* out_data,
1956
+ MSHADOW_XINLINE static void Map (index_t i, DType* out_data,
1956
1957
DType* state_n_data, DType* state_g_data, DType* delta_data,
1957
1958
const DType* weight_data, const DType* grad_data,
1958
1959
const DType clip_gradient, const DType rescale_grad,
@@ -2051,7 +2052,7 @@ struct RMSPropParam : public dmlc::Parameter<RMSPropParam> {
2051
2052
2052
2053
struct RMSPropUpdateKernel {
2053
2054
template <typename DType>
2054
- MSHADOW_XINLINE static void Map (int i,
2055
+ MSHADOW_XINLINE static void Map (index_t i,
2055
2056
DType* out_data, DType* state_n_data,
2056
2057
const DType* weight_data, const DType* grad_data,
2057
2058
const DType clip_gradient, const DType rescale_grad,
@@ -2132,7 +2133,7 @@ struct FtrlParam : public dmlc::Parameter<FtrlParam> {
2132
2133
2133
2134
struct FtrlUpdateKernel {
2134
2135
template <typename DType>
2135
- MSHADOW_XINLINE static void Map (int i, DType* out_data,
2136
+ MSHADOW_XINLINE static void Map (index_t i, DType* out_data,
2136
2137
DType* n_data, DType* z_data, const DType* weight_data, const DType* grad_data,
2137
2138
const DType clip_gradient, const DType rescale_grad,
2138
2139
const DType beta, const DType lamda1,
@@ -2185,7 +2186,7 @@ inline void FtrlUpdate(const nnvm::NodeAttrs& attrs,
2185
2186
template <int req>
2186
2187
struct FtrlDnsRspDnsKernel {
2187
2188
template <typename DType, typename IType>
2188
- MSHADOW_XINLINE static void Map (int i, const nnvm::dim_t row_length, DType* out_data,
2189
+ MSHADOW_XINLINE static void Map (index_t i, const nnvm::dim_t row_length, DType* out_data,
2189
2190
DType* z_data, DType* n_data, const DType* weight_data, const IType* grad_idx,
2190
2191
const DType* grad_data, const DType clip_gradient, const DType lamda1, const DType beta,
2191
2192
const DType lr, const DType wd, const DType rescale_grad) {
@@ -2343,7 +2344,7 @@ struct SignSGDParam : public dmlc::Parameter<SignSGDParam> {
2343
2344
2344
2345
struct SignSGDKernel {
2345
2346
template <typename DType>
2346
- MSHADOW_XINLINE static void Map (int i, DType* out_data, const DType* weight_data,
2347
+ MSHADOW_XINLINE static void Map (index_t i, DType* out_data, const DType* weight_data,
2347
2348
const DType* grad_data, const DType param_clip_gradient,
2348
2349
const DType param_lr, const DType param_wd, const DType param_rescale_grad,
2349
2350
const OpReqType req) {
@@ -2411,10 +2412,12 @@ struct SignumParam : public dmlc::Parameter<SignumParam> {
2411
2412
2412
2413
struct SignumKernel {
2413
2414
template <typename DType>
2414
- MSHADOW_XINLINE static void Map (int i, DType* out_data, DType* mom_data, const DType* weight_data,
2415
- const DType* grad_data, const DType param_clip_gradient, const DType param_momentum,
2416
- const DType param_lr, const DType param_wd, const DType param_rescale_grad,
2417
- const DType param_wd_lh, const OpReqType req) {
2415
+ MSHADOW_XINLINE static void Map (index_t i, DType* out_data, DType* mom_data,
2416
+ const DType* weight_data, const DType* grad_data,
2417
+ const DType param_clip_gradient, const DType param_momentum,
2418
+ const DType param_lr, const DType param_wd,
2419
+ const DType param_rescale_grad, const DType param_wd_lh,
2420
+ const OpReqType req) {
2418
2421
if (param_clip_gradient >= 0 .0f ) {
2419
2422
mom_data[i] = param_momentum*mom_data[i]
2420
2423
- (1 -param_momentum)*param_wd*weight_data[i]
@@ -2506,7 +2509,7 @@ struct AdagradDnsRspDnsKernel;
2506
2509
template <>
2507
2510
struct AdagradDnsRspDnsKernel <cpu> {
2508
2511
template <typename DType, typename IType>
2509
- MSHADOW_XINLINE static void Map (int i, index_t row_length, DType* out_data,
2512
+ MSHADOW_XINLINE static void Map (index_t i, index_t row_length, DType* out_data,
2510
2513
DType* state_data, const DType* weight_data, const IType* grad_idx,
2511
2514
const DType* grad_data, const DType clip_gradient, const DType epsilon,
2512
2515
const DType lr, const DType rescale_grad) {
@@ -2533,7 +2536,7 @@ struct AdagradDnsRspDnsKernel<cpu> {
2533
2536
template <>
2534
2537
struct AdagradDnsRspDnsKernel <gpu> {
2535
2538
template <typename DType, typename IType>
2536
- MSHADOW_XINLINE static void Map (int i, index_t row_length, DType* out_data,
2539
+ MSHADOW_XINLINE static void Map (index_t i, index_t row_length, DType* out_data,
2537
2540
DType* state_data, const DType* weight_data, const IType* grad_idx,
2538
2541
const DType* grad_data, const DType clip_gradient, const DType epsilon,
2539
2542
const DType lr, const DType rescale_grad) {
0 commit comments