提交 a2194555 编写于 作者: Y Yu Yang

Rise type error because of python.

上级 c3caa842
...@@ -164,20 +164,20 @@ def __check_train_args__(train_data_reader, topology, parameters, ...@@ -164,20 +164,20 @@ def __check_train_args__(train_data_reader, topology, parameters,
""" """
if not callable(train_data_reader) or not isinstance(train_data_reader(), if not callable(train_data_reader) or not isinstance(train_data_reader(),
collections.Iterator): collections.Iterator):
raise ValueError('train_data_reader should be a function, ' raise TypeError('train_data_reader should be a function, '
'which can return a iterator') 'which can return a iterator')
if test_data_reader is not None: if test_data_reader is not None:
if not callable(test_data_reader) or not isinstance( if not callable(test_data_reader) or not isinstance(
test_data_reader(), collections.Iterator): test_data_reader(), collections.Iterator):
raise ValueError('test_data_reader should be a function, which can ' raise TypeError('test_data_reader should be a function, which can '
'return a iterator') 'return a iterator')
if not isinstance(topology, ModelConfig): if not isinstance(topology, ModelConfig):
raise ValueError('topology should be a model config') raise TypeError('topology should be a model config')
if not isinstance(parameters, v2_parameters.Parameters): if not isinstance(parameters, v2_parameters.Parameters):
raise ValueError('parameters should be a parameter pool') raise TypeError('parameters should be a parameter pool')
if not callable(event_handler): if not callable(event_handler):
raise ValueError('event handler should be a function') raise TypeError('event handler should be a function')
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册