提交 82b42e31 编写于 作者: Y Yancey1989

polish unittest test=develop

上级 0a885ac1
...@@ -186,7 +186,6 @@ RecordEvent::RecordEvent(const std::string& name, const DeviceContext* dev_ctx) ...@@ -186,7 +186,6 @@ RecordEvent::RecordEvent(const std::string& name, const DeviceContext* dev_ctx)
RecordEvent::~RecordEvent() { RecordEvent::~RecordEvent() {
if (g_state == ProfilerState::kDisabled || !is_enabled_) return; if (g_state == ProfilerState::kDisabled || !is_enabled_) return;
VLOG(5) << "call ~RecordEvent";
std::lock_guard<std::mutex> l(profiler_mu); std::lock_guard<std::mutex> l(profiler_mu);
DeviceTracer* tracer = GetDeviceTracer(); DeviceTracer* tracer = GetDeviceTracer();
if (tracer) { if (tracer) {
......
...@@ -138,6 +138,13 @@ class TestMNIST(TestParallelExecutorBase): ...@@ -138,6 +138,13 @@ class TestMNIST(TestParallelExecutorBase):
"label": label}, "label": label},
use_cuda=use_cuda, use_cuda=use_cuda,
use_parallel_executor=False) use_parallel_executor=False)
parallel_first_loss, parallel_last_loss = self.check_network_convergence(
method=simple_fc_net,
seed=1,
feed_dict={"image": img,
"label": label},
use_cuda=use_cuda,
use_parallel_executor=True)
self.assertAlmostEquals( self.assertAlmostEquals(
np.mean(parallel_first_loss), np.mean(parallel_first_loss),
...@@ -149,8 +156,6 @@ class TestMNIST(TestParallelExecutorBase): ...@@ -149,8 +156,6 @@ class TestMNIST(TestParallelExecutorBase):
def test_simple_fc_parallel_accuracy(self): def test_simple_fc_parallel_accuracy(self):
if core.is_compiled_with_cuda(): if core.is_compiled_with_cuda():
self.check_simple_fc_parallel_accuracy(True) self.check_simple_fc_parallel_accuracy(True)
self.check_simple_fc_parallel_accuracy(True)
# FIXME(Yancey1989): ParallelGraph executor type support CPU mode
self.check_simple_fc_parallel_accuracy(False) self.check_simple_fc_parallel_accuracy(False)
def check_batchnorm_fc_convergence(self, use_cuda, use_fast_executor): def check_batchnorm_fc_convergence(self, use_cuda, use_fast_executor):
...@@ -171,9 +176,6 @@ class TestMNIST(TestParallelExecutorBase): ...@@ -171,9 +176,6 @@ class TestMNIST(TestParallelExecutorBase):
for use_fast_executor in (False, True): for use_fast_executor in (False, True):
self.check_batchnorm_fc_convergence(use_cuda, use_fast_executor) self.check_batchnorm_fc_convergence(use_cuda, use_fast_executor)
self.check_batchnorm_fc_convergence(
use_cuda=True, use_fast_executor=False)
def test_batchnorm_fc_with_new_strategy(self): def test_batchnorm_fc_with_new_strategy(self):
# FIXME(zcd): close this test temporally. # FIXME(zcd): close this test temporally.
# self._compare_reduce_and_allreduce(fc_with_batchnorm, True) # self._compare_reduce_and_allreduce(fc_with_batchnorm, True)
......
...@@ -313,9 +313,7 @@ class TestResnet(TestParallelExecutorBase): ...@@ -313,9 +313,7 @@ class TestResnet(TestParallelExecutorBase):
np.mean(parallel_last_loss), single_last_loss[0], delta=delta2) np.mean(parallel_last_loss), single_last_loss[0], delta=delta2)
def test_seresnext_with_learning_rate_decay(self): def test_seresnext_with_learning_rate_decay(self):
if core.is_compiled_with_cuda(): self._check_resnet_convergence(model=SE_ResNeXt50Small, use_cuda=True)
self._check_resnet_convergence(
model=SE_ResNeXt50Small, use_cuda=True)
self._check_resnet_convergence( self._check_resnet_convergence(
model=SE_ResNeXt50Small, use_cuda=False, iter=2, delta2=1e-3) model=SE_ResNeXt50Small, use_cuda=False, iter=2, delta2=1e-3)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册