From 00ed56430782f953ab42e549fe94938271f9e194 Mon Sep 17 00:00:00 2001 From: Yi Wang Date: Tue, 18 Jul 2017 16:40:22 -0700 Subject: [PATCH] Update --- paddle/framework/CMakeLists.txt | 3 +++ paddle/operators/add_op.h | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/paddle/framework/CMakeLists.txt b/paddle/framework/CMakeLists.txt index eb3416462..a00b9c819 100644 --- a/paddle/framework/CMakeLists.txt +++ b/paddle/framework/CMakeLists.txt @@ -4,8 +4,11 @@ cc_test(enforce_test SRCS enforce_test.cc DEPS enforce) cc_library(ddim SRCS ddim.cc DEPS eigen3) cc_test(ddim_test SRCS ddim_test.cc DEPS ddim) nv_test(dim_test SRCS dim_test.cu DEPS ddim) + cc_library(tensor SRCS tensor.cc DEPS ddim place enforce paddle_memory) cc_test(tensor_test SRCS tensor_test.cc DEPS tensor) +cc_test(eigen_test SRCS eigen_test.cc DEPS tensor) + cc_test(variable_test SRCS variable_test.cc) cc_test(scope_test SRCS scope_test.cc) proto_library(attr_type SRCS attr_type.proto) diff --git a/paddle/operators/add_op.h b/paddle/operators/add_op.h index e08b3fb18..e7c106a23 100644 --- a/paddle/operators/add_op.h +++ b/paddle/operators/add_op.h @@ -14,6 +14,7 @@ limitations under the License. */ #pragma once #include "glog/logging.h" +#include "paddle/framework/eigen.h" #include "paddle/framework/operator.h" namespace paddle { @@ -29,8 +30,9 @@ public: output->mutable_data(context.GetPlace()); - output->flat().device(*(context.GetEigenDevice())) = - input0.flat() + input1.flat(); + framework::EigenVector::From(*output).device( + *(context.GetEigenDevice())) = + framework::EigenVector(*input0) + framework::EigenVector(*input1); } }; -- GitLab