提交 c0a6237d 编写于 作者: D dzhwinter

"fix ci"

上级 8c7d2e29
...@@ -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.
先完成此消息的编辑!
想要评论请 注册