提交 e42cafb2 编写于 作者: Q qijun

add executor unittest

上级 3481bdc8
......@@ -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,7 +91,7 @@ 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,
Executor* NewLocalExecutor(const platform::Place& place,
const ProgramDesc& pdesc, bool is_linear) {
platform::DeviceContext* device_context = nullptr;
if (platform::is_cpu_place(place)) {
......
......@@ -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) {}
\ No newline at end of file
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();
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册