From d239cf2e156e6765c65c918ce49b83a32d230c8c Mon Sep 17 00:00:00 2001 From: dzhwinter Date: Wed, 17 Oct 2018 16:40:39 +0800 Subject: [PATCH] use binary search. test=develop --- paddle/fluid/operators/momentum_op.h | 32 ++++------------------------ 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/paddle/fluid/operators/momentum_op.h b/paddle/fluid/operators/momentum_op.h index dae74a5ad93..4a74c078e6a 100644 --- a/paddle/fluid/operators/momentum_op.h +++ b/paddle/fluid/operators/momentum_op.h @@ -153,33 +153,6 @@ class DenseMomentumFunctor { } }; -// TODO(dzh): enhance speed use eigen -// template -// class CPUSparseMomentumFunctor { -// private: -// const T* p_; -// const T* g_; -// const T* v_; -// const T* lr_; -// const T mu_; -// const bool use_nesterov_; -// const int64_t* rows_; -// const int64_t row_numel_; -// const int64_t row_height_; -// T* p_out_; -// T* v_out_; - -// public: -// CPUSparseMomentumFunctor(const T* p, const T* g, const T* v, const T* lr, -// const T mu, const bool use_nesterov, const int64_t* rows, const int64_t -// row_numel, const int64_t row_height, T* p_out, T* v_out) :p_(p), g_(g), -// v_(v), lr_(lr), mu_(mu), rows_(rows), row_numel_(row_numel), -// row_height_(row_height), p_out_(p_out), v_out_(v_out) {} -// inline void operator()() { - -// } -// }; - template class SparseMomentumFunctor; @@ -367,7 +340,10 @@ class MomentumOpKernel : public framework::OpKernel { for_range(functor); } } else { - PADDLE_THROW("Unsupported Variable Type of Grad"); + PADDLE_THROW( + string::Sprintf("MomentumOp only supports LoDTensor or SelectedRows " + "gradient, but the received Variable Type is %s", + grad_var->Type().name())); } } }; -- GitLab