Fix flake8 format errors in CTC

上级 f360935f
...@@ -156,4 +156,4 @@ def local_gpu_ctc_no_grad(node): ...@@ -156,4 +156,4 @@ def local_gpu_ctc_no_grad(node):
if len(node.outputs) > 1: if len(node.outputs) > 1:
if len(node.outputs[1].clients) == 0: # gradient is not used if len(node.outputs[1].clients) == 0: # gradient is not used
return [GpuConnectionistTemporalClassification(compute_grad=False)(*node.inputs), None] return [GpuConnectionistTemporalClassification(compute_grad=False)(*node.inputs), None]
return False return False
\ No newline at end of file
...@@ -25,6 +25,7 @@ def _ctc_find_lib(): ...@@ -25,6 +25,7 @@ def _ctc_find_lib():
return True, lib_path return True, lib_path
return False, None return False, None
def _ctc_check_compile(ctc_lib_path): def _ctc_check_compile(ctc_lib_path):
preambule = """ preambule = """
#include <string.h> #include <string.h>
...@@ -52,6 +53,7 @@ options.num_threads = 1; ...@@ -52,6 +53,7 @@ options.num_threads = 1;
"We got this error:\n" + str(err)) "We got this error:\n" + str(err))
return True, None return True, None
def ctc_present(): def ctc_present():
if ctc_present.avail is not None: if ctc_present.avail is not None:
return ctc_present.avail return ctc_present.avail
...@@ -64,10 +66,12 @@ def ctc_present(): ...@@ -64,10 +66,12 @@ def ctc_present():
ctc_present.avail, ctc_present.msg = _ctc_check_compile(ctc_present.path) ctc_present.avail, ctc_present.msg = _ctc_check_compile(ctc_present.path)
return ctc_present.avail return ctc_present.avail
ctc_present.avail = None ctc_present.avail = None
ctc_present.msg = None ctc_present.msg = None
ctc_present.path = None ctc_present.path = None
def ctc_available(): def ctc_available():
if config.ctc.root == '': if config.ctc.root == '':
ctc_available.msg = 'ctc.root variable is not set, please set it ', ctc_available.msg = 'ctc.root variable is not set, please set it ',
...@@ -85,6 +89,7 @@ def ctc_available(): ...@@ -85,6 +89,7 @@ def ctc_available():
ctc_available.path = ctc_present.path ctc_available.path = ctc_present.path
return True return True
ctc_available.msg = None ctc_available.msg = None
ctc_available.path = None ctc_available.path = None
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论