提交 c72a4f4d 编写于 作者: Y yuyang18

Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into feature/exec_strategy

...@@ -56,6 +56,8 @@ ExternalProject_Add( ...@@ -56,6 +56,8 @@ ExternalProject_Add(
GIT_TAG "v0.14" GIT_TAG "v0.14"
PREFIX ${MKLDNN_SOURCES_DIR} PREFIX ${MKLDNN_SOURCES_DIR}
UPDATE_COMMAND "" UPDATE_COMMAND ""
# Patch MKLDNN to compile with gcc 4.8, the related issue is in intel/mkl-dnn#237.
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/patches/mkldnn.hpp ${MKLDNN_SOURCES_DIR}/src/extern_mkldnn/include/mkldnn.hpp
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${MKLDNN_INSTALL_DIR} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${MKLDNN_INSTALL_DIR}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
CMAKE_ARGS -DMKLROOT=${MKLML_ROOT} CMAKE_ARGS -DMKLROOT=${MKLML_ROOT}
......
此差异已折叠。
...@@ -27,12 +27,15 @@ class TestNetWithDtype(unittest.TestCase): ...@@ -27,12 +27,15 @@ class TestNetWithDtype(unittest.TestCase):
def set_network(self): def set_network(self):
self.dtype = "float64" self.dtype = "float64"
self.init_dtype() self.init_dtype()
self.x = fluid.layers.data(name='x', shape=[13], dtype=self.dtype) main = fluid.Program()
self.y = fluid.layers.data(name='y', shape=[1], dtype=self.dtype) with fluid.program_guard(main):
y_predict = fluid.layers.fc(input=self.x, size=1, act=None) self.x = fluid.layers.data(name='x', shape=[13], dtype=self.dtype)
self.y = fluid.layers.data(name='y', shape=[1], dtype=self.dtype)
y_predict = fluid.layers.fc(input=self.x, size=1, act=None)
cost = fluid.layers.square_error_cost(input=y_predict, label=self.y) cost = fluid.layers.square_error_cost(input=y_predict, label=self.y)
avg_cost = fluid.layers.mean(cost) avg_cost = fluid.layers.mean(cost)
self.program = main
self.fetch_list = [avg_cost] self.fetch_list = [avg_cost]
sgd_optimizer = fluid.optimizer.SGD(learning_rate=0.001) sgd_optimizer = fluid.optimizer.SGD(learning_rate=0.001)
...@@ -45,7 +48,7 @@ class TestNetWithDtype(unittest.TestCase): ...@@ -45,7 +48,7 @@ class TestNetWithDtype(unittest.TestCase):
exe = fluid.Executor(place) exe = fluid.Executor(place)
exe.run(fluid.default_startup_program()) exe.run(fluid.default_startup_program())
for data in train_reader(): for data in train_reader():
exe.run(fluid.default_main_program(), exe.run(self.program,
feed=feeder.feed(data), feed=feeder.feed(data),
fetch_list=self.fetch_list) fetch_list=self.fetch_list)
# the main program is runable, the datatype is fully supported # the main program is runable, the datatype is fully supported
...@@ -68,7 +71,7 @@ class TestNetWithDtype(unittest.TestCase): ...@@ -68,7 +71,7 @@ class TestNetWithDtype(unittest.TestCase):
# TODO(dzhwinter): make sure the fp16 is runable # TODO(dzhwinter): make sure the fp16 is runable
# class TestFloat16(SimpleNet): # class TestFloat16(TestNetWithDtype):
# def init_dtype(self): # def init_dtype(self):
# self.dtype = "float16" # self.dtype = "float16"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册