diff --git a/paddle/operators/mul_op.cc b/paddle/operators/mul_op.cc index 7aa63961a0f49aad7dc88360f1d466b401ca83a2..fa224786895f1ca074da0e275e4187340f8bbad6 100644 --- a/paddle/operators/mul_op.cc +++ b/paddle/operators/mul_op.cc @@ -12,9 +12,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -#include -#include -#include +#include "paddle/operators/mul_op.h" +#include "paddle/framework/op_registry.h" +#include "paddle/framework/tensor.h" namespace paddle { namespace operators { diff --git a/paddle/operators/mul_op.cu b/paddle/operators/mul_op.cu index 75f00e746c22968815a450dfc1fc8982ebe677c0..3ee581dc77dc08e6e47b240588811fbc7c6ea303 100644 --- a/paddle/operators/mul_op.cu +++ b/paddle/operators/mul_op.cu @@ -12,8 +12,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -#include -#include +#include "paddle/operators/mul_op.h" +#include "paddle/framework/op_registry.h" REGISTER_OP_GPU_KERNEL(mul, paddle::operators::MulKernel -#include +#include "glog/logging.h" +#include "paddle/framework/eigen.h" +#include "paddle/framework/operator.h" namespace paddle { namespace operators { @@ -34,8 +35,10 @@ public: output->mutable_data(context.GetPlace()); - output->matrix().device(*(context.GetEigenDevice())) = - input0.matrix().contract(input1.matrix(), dim_pair); + framework::EigenMatrix::From(*output).device( + *(context.GetEigenDevice())) = + framework::EigenMatrix::From(input0).contract( + framework::EigenMatrix::From(input1), dim_pair); } }; } // namespace operators diff --git a/paddle/operators/rowwise_add_op.cc b/paddle/operators/rowwise_add_op.cc index 567b058fd07a74014cac728e7d10f6f2f272ef38..2590dff7bccc9723c558bebdf442c43db9d009e4 100644 --- a/paddle/operators/rowwise_add_op.cc +++ b/paddle/operators/rowwise_add_op.cc @@ -12,8 +12,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -#include -#include +#include "paddle/operators/rowwise_add_op.h" +#include "paddle/framework/op_registry.h" namespace paddle { namespace operators { diff --git a/paddle/operators/rowwise_add_op.cu b/paddle/operators/rowwise_add_op.cu index 58fe96a4a35314909b99a6c2f0442420c6243fc2..5dfac4fd2cf9b7da24dcfa5e7583b9ece12bad1e 100644 --- a/paddle/operators/rowwise_add_op.cu +++ b/paddle/operators/rowwise_add_op.cu @@ -1,5 +1,5 @@ -#include -#include +#include "paddle/framework/op_registry.h" +#include "paddle/operators/rowwise_add_op.h" REGISTER_OP_GPU_KERNEL( rowwise_add, diff --git a/paddle/operators/rowwise_add_op.h b/paddle/operators/rowwise_add_op.h index f1d43002dc56ff36a7145795f721422d97d4fdde..ffe9378404e0220fc51593ac1db1c778ee9cbcbb 100644 --- a/paddle/operators/rowwise_add_op.h +++ b/paddle/operators/rowwise_add_op.h @@ -13,8 +13,9 @@ limitations under the License. */ #pragma once -#include -#include +#include "glog/logging.h" +#include "paddle/framework/eigen.h" +#include "paddle/framework/operator.h" namespace paddle { namespace operators { @@ -27,9 +28,9 @@ public: auto in1 = context.Input(1)->Get(); auto* out = context.Output(0)->GetMutable(); - auto input = in0.matrix(); - auto bias = in1.vec(); - auto output = out->matrix(); + auto input = framework::EigenMatrix::From(in0); + auto bias = framework::EigenVector::From(in1); + auto output = framework::EigenMatrix::From(*out); const int bias_size = bias.dimension(0); const int rest_size = input.size() / bias_size; diff --git a/paddle/operators/sigmoid_op.cc b/paddle/operators/sigmoid_op.cc index fa13f2c4f74c583aff56f907178c77b4acf5d37e..589b48ce803da6b18d599d39403fa30dc3f33474 100644 --- a/paddle/operators/sigmoid_op.cc +++ b/paddle/operators/sigmoid_op.cc @@ -12,8 +12,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -#include -#include +#include "paddle/operators/sigmoid_op.h" +#include "paddle/framework/op_registry.h" namespace paddle { namespace operators { diff --git a/paddle/operators/sigmoid_op.cu b/paddle/operators/sigmoid_op.cu index 59bba2729f7efb31f633dc8448e8b8db51ede49a..ed344b2bfd4a9eeef2ce79746bec608469503c9c 100644 --- a/paddle/operators/sigmoid_op.cu +++ b/paddle/operators/sigmoid_op.cu @@ -1,5 +1,5 @@ -#include -#include +#include "paddle/operators/sigmoid_op.h" +#include "paddle/framework/op_registry.h" REGISTER_OP_GPU_KERNEL( sigmoid, paddle::operators::SigmoidKernel); diff --git a/paddle/operators/sigmoid_op.h b/paddle/operators/sigmoid_op.h index 7995b75297c7b040f5a000e2d39918ce3b5bd4a0..2b9356246c471853b53af1d73f8b2a3c206db7ad 100644 --- a/paddle/operators/sigmoid_op.h +++ b/paddle/operators/sigmoid_op.h @@ -14,8 +14,9 @@ #pragma once -#include -#include +#include "glog/logging.h" +#include "paddle/framework/eigen.h" +#include "paddle/framework/operator.h" namespace paddle { namespace operators { @@ -29,8 +30,9 @@ public: output->mutable_data(context.GetPlace()); - output->flat().device(*(context.GetEigenDevice())) = - 1.0 / (1.0 + (-1.0 * input.flat()).exp()); + framework::EigenVector::Flatten(*output).device( + *(context.GetEigenDevice())) = + 1.0 / (1.0 + (-1.0 * framework::EigenVector::Flatten(input)).exp()); } }; } // namespace operators diff --git a/paddle/operators/softmax_op.cc b/paddle/operators/softmax_op.cc index 42795adbdc83658558d116ba87ffc6bf34a6fc8e..81bad748657c72e356e8540bfb60799d91420a4d 100644 --- a/paddle/operators/softmax_op.cc +++ b/paddle/operators/softmax_op.cc @@ -11,8 +11,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include -#include +#include "paddle/operators/softmax_op.h" +#include "paddle/framework/op_registry.h" namespace paddle { namespace operators { diff --git a/paddle/operators/softmax_op.cu b/paddle/operators/softmax_op.cu index 730c76a04b58636069431c193bd03584411f2b4a..60676191eb9460868a266d0e4f70357fa78bec2c 100644 --- a/paddle/operators/softmax_op.cu +++ b/paddle/operators/softmax_op.cu @@ -1,5 +1,5 @@ -#include -#include +#include "paddle/framework/op_registry.h" +#include "paddle/operators/softmax_op.h" REGISTER_OP_GPU_KERNEL( softmax, paddle::operators::SoftmaxKernel); diff --git a/paddle/operators/softmax_op.h b/paddle/operators/softmax_op.h index 34a6c299bbff4da63ff179ae093c0c6866436d06..53c626a7929dd150582ba0e65ff5183fe1198b04 100644 --- a/paddle/operators/softmax_op.h +++ b/paddle/operators/softmax_op.h @@ -14,8 +14,9 @@ #pragma once -#include -#include +#include "glog/logging.h" +#include "paddle/framework/eigen.h" +#include "paddle/framework/operator.h" namespace paddle { namespace operators { @@ -27,8 +28,8 @@ public: auto input = context.Input(0)->Get(); auto* output = context.Output(0)->GetMutable(); - auto logits = input.matrix(); - auto softmax = output->matrix(); + auto logits = framework::EigenMatrix::From(input); + auto softmax = framework::EigenMatrix::From(*output); const int kBatchDim = 0; const int kClassDim = 1;