未验证 提交 8231960f 编写于 作者: T Tao Luo 提交者: GitHub

Merge pull request #10629 from dzhwinter/fix/test_dtype

"fix dtype ci error"
......@@ -27,12 +27,15 @@ class TestNetWithDtype(unittest.TestCase):
def set_network(self):
self.dtype = "float64"
self.init_dtype()
main = fluid.Program()
with fluid.program_guard(main):
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)
avg_cost = fluid.layers.mean(cost)
self.program = main
self.fetch_list = [avg_cost]
sgd_optimizer = fluid.optimizer.SGD(learning_rate=0.001)
......@@ -45,7 +48,7 @@ class TestNetWithDtype(unittest.TestCase):
exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
for data in train_reader():
exe.run(fluid.default_main_program(),
exe.run(self.program,
feed=feeder.feed(data),
fetch_list=self.fetch_list)
# the main program is runable, the datatype is fully supported
......@@ -68,7 +71,7 @@ class TestNetWithDtype(unittest.TestCase):
# TODO(dzhwinter): make sure the fp16 is runable
# class TestFloat16(SimpleNet):
# class TestFloat16(TestNetWithDtype):
# def init_dtype(self):
# self.dtype = "float16"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册