clip_op gradient calculation is wrong.
Created by: wanglei828
In https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/fluid/operators/clip_op.h The clip grad functor is defined like this:
template class ClipGradFunctor { public: explicit ClipGradFunctor(const T min, const T max) : min_(min), max_(max) {} HOSTDEVICE T operator()(const T& x, const T& y) const { return (y > min_ && y < max_) ? x : 0; }
private: T min_; T max_; };
I think the gradient calculation is wrong, it should be: return (y > min_ && y < max_) ? 1 : 0;