add executor unittest

revert-4814-Add_sequence_project_op
qijun 8 years ago
parent 3481bdc865
commit e42cafb24f

@ -45,3 +45,4 @@ cc_library(backward SRCS backward.cc DEPS net_op)
cc_test(backward_test SRCS backward_test.cc DEPS backward recurrent_op device_context)
cc_library(executor SRCS executor.cc DEPS device_context framework_proto)
cc_test(executor_test SRCS executor_test.cc DEPS executor)

@ -40,7 +40,7 @@ class GraphView : public ProgramDescView {
void Initialize(const ProgramDesc*) override;
};
static ProgramDescView* Create(bool is_linear) {
ProgramDescView* ProgramDescView::Create(bool is_linear) {
if (is_linear) {
return new LinearListView();
} else {
@ -91,8 +91,8 @@ static std::unique_ptr<platform::CUDADeviceContext> g_cuda_device_context =
make_unique<platform::CUDADeviceContext>(platform::GPUPlace(0));
#endif
static Executor* NewLocalExecutor(const platform::Place& place,
const ProgramDesc& pdesc, bool is_linear) {
Executor* NewLocalExecutor(const platform::Place& place,
const ProgramDesc& pdesc, bool is_linear) {
platform::DeviceContext* device_context = nullptr;
if (platform::is_cpu_place(place)) {
device_context = g_cpu_device_context.get();

@ -26,7 +26,7 @@ class Executor {
virtual void Run() = 0;
};
static Executor* NewLocalExecutor(const platform::Place&, const ProgramDesc&);
Executor* NewLocalExecutor(const platform::Place&, const ProgramDesc&, bool);
} // namespace framework
} // namespace paddle

@ -15,4 +15,12 @@ limitations under the License. */
#include "paddle/framework/executor.h"
#include "gtest/gtest.h"
TEST(Executor, Init) {}
using namespace paddle::platform;
using namespace paddle::framework;
TEST(Executor, Init) {
ProgramDesc pdesc;
CPUPlace cpu_place;
Executor* executor = NewLocalExecutor(cpu_place, pdesc, true);
executor->Run();
}
Loading…
Cancel
Save