use CUB to optimize ElementwiseLinearGradientKernel
use CUB to optimize ElementwiseLinearGradientKernel

Summary: Use a proper reduction in the gradient kernel. This gives about 25% speedup with the n, D I tried (see P57333872), but with larger N, the improvement can be much more sizeable.

Reviewed By: stephenyan1231

Differential Revision: D4941218

fbshipit-source-id: 627eaf26fc20a81f1ef449f39eda0d2191b8c746

Yangqing/caffe2,sf-wind/caffe2,pietern/caffe2,xzturn/caffe2,Yangqing/caffe2,bwasti/caffe2,davinwang/caffe2,davinwang/caffe2,pietern/caffe2,bwasti/caffe2,davinwang/caffe2,davinwang/caffe2,pietern/caffe2,sf-wind/caffe2,davinwang/caffe2,bwasti/caffe2,bwasti/caffe2,xzturn/caffe2,xzturn/caffe2,sf-wind/caffe2,caffe2/caffe2,sf-wind/caffe2,Yangqing/caffe2,bwasti/caffe2,pietern/caffe2,Yangqing/caffe2,xzturn/caffe2,xzturn/caffe2,pietern/caffe2,Yangqing/caffe2,sf-wind/caffe2