#pragma once #include "glog/logging.h" #include "paddle/framework/operator.h" //#include "paddle/operators/add_op_functor.h" namespace paddle { namespace operators { template class AddKernel : public framework::OpKernel { public: void Compute(const KernelContext& context) const override { auto input0 = context.Input(0)->Get(); auto input1 = context.Input(1)->Get(); auto* output = context.Output(0)->GetMutable(); output->mutable_data(Place()); output->flat().device(*(context.get_eigen_device())) = input0.flat() + input1.flat(); } }; } // namespace operators } // namespace paddle