提交 415460b5 编写于 作者: J JiayiFeng

stash

上级 e412b1ae
...@@ -229,13 +229,13 @@ class TestParallelExecutorBase(unittest.TestCase): ...@@ -229,13 +229,13 @@ class TestParallelExecutorBase(unittest.TestCase):
if batch_size is not None: if batch_size is not None:
batch_size *= fluid.core.get_cuda_device_count() batch_size *= fluid.core.get_cuda_device_count()
begin = time.time() begin = time.time()
first_loss, = exe.run([loss.name], feed_dict=feed_dict) first_loss, = exe.run([loss.name], feed=feed_dict)
first_loss = numpy.array(first_loss) first_loss = numpy.array(first_loss)
for i in xrange(iter): for i in xrange(iter):
exe.run([], feed_dict=feed_dict) exe.run([], feed=feed_dict)
last_loss, = exe.run([loss.name], feed_dict=feed_dict) last_loss, = exe.run([loss.name], feed=feed_dict)
end = time.time() end = time.time()
if batch_size is not None: if batch_size is not None:
...@@ -277,11 +277,10 @@ class TestMNIST(TestParallelExecutorBase): ...@@ -277,11 +277,10 @@ class TestMNIST(TestParallelExecutorBase):
"label": label}) "label": label})
def test_simple_fc_parallel_accuracy(self): def test_simple_fc_parallel_accuracy(self):
single_first_loss, single_last_loss = self.check_network_convergence( #single_first_loss, single_last_loss = self.check_network_convergence(
simple_fc_net, seed=0, use_parallel_executor=False) # simple_fc_net, seed=0, use_parallel_executor=False)
parallel_first_loss, parallel_last_loss = self.check_network_convergence( #parallel_first_loss, parallel_last_loss = self.check_network_convergence(
simple_fc_net, seed=0, use_parallel_executor=True) # simple_fc_net, seed=0, use_parallel_executor=True)
print("FUCK")
print('single_first_loss=', single_first_loss) print('single_first_loss=', single_first_loss)
print('single_last_loss=', single_last_loss) print('single_last_loss=', single_last_loss)
print('parallel_first_loss=', parallel_first_loss) print('parallel_first_loss=', parallel_first_loss)
...@@ -515,10 +514,10 @@ class ParallelExecutorTestingDuringTraining(unittest.TestCase): ...@@ -515,10 +514,10 @@ class ParallelExecutorTestingDuringTraining(unittest.TestCase):
share_vars_from=train_exe) share_vars_from=train_exe)
for i in xrange(5): for i in xrange(5):
test_loss, = test_exe.run([loss.name], feed_dict=feed_dict) test_loss, = test_exe.run([loss.name], feed=feed_dict)
test_loss = numpy.array(test_loss) test_loss = numpy.array(test_loss)
train_loss, = train_exe.run([loss.name], feed_dict=feed_dict) train_loss, = train_exe.run([loss.name], feed=feed_dict)
train_loss = numpy.array(train_loss) train_loss = numpy.array(train_loss)
self.assertTrue( self.assertTrue(
numpy.allclose( numpy.allclose(
...@@ -668,5 +667,5 @@ class TestCRFModel(unittest.TestCase): ...@@ -668,5 +667,5 @@ class TestCRFModel(unittest.TestCase):
for i in xrange(10): for i in xrange(10):
cur_batch = next(data) cur_batch = next(data)
print map(numpy.array, print map(numpy.array,
pe.run(feed_dict=feeder.feed(cur_batch), pe.run(feed=feeder.feed(cur_batch),
fetch_list=[avg_cost.name]))[0] fetch_list=[avg_cost.name]))[0]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册