提交 50edf524 编写于 作者: Y Yu Yang 提交者: GitHub

Merge pull request #862 from backyes/fix_data_sources

refine data_sources.py and PyDataProvider2.py to make more readable
...@@ -107,8 +107,7 @@ def integer_value_sub_sequence(dim): ...@@ -107,8 +107,7 @@ def integer_value_sub_sequence(dim):
return integer_value(dim, seq_type=SequenceType.SUB_SEQUENCE) return integer_value(dim, seq_type=SequenceType.SUB_SEQUENCE)
def integer_sequence(dim): integer_sequence = integer_value_sequence
return index_slot(dim, seq_type=SequenceType.SEQUENCE)
class SingleSlotWrapper(object): class SingleSlotWrapper(object):
......
...@@ -78,21 +78,6 @@ def define_py_data_source(file_list, ...@@ -78,21 +78,6 @@ def define_py_data_source(file_list,
if not isinstance(args, basestring) and args is not None: if not isinstance(args, basestring) and args is not None:
args = pickle.dumps(args, 0) args = pickle.dumps(args, 0)
if data_cls is None:
def py_data2(files, load_data_module, load_data_object, load_data_args,
**kwargs):
data = DataBase()
data.type = 'py2'
data.files = files
data.load_data_module = load_data_module
data.load_data_object = load_data_object
data.load_data_args = load_data_args
data.async_load_data = True
return data
data_cls = py_data2
cls( cls(
data_cls( data_cls(
files=file_list, files=file_list,
...@@ -207,10 +192,22 @@ def define_py_data_sources2(train_list, test_list, module, obj, args=None): ...@@ -207,10 +192,22 @@ def define_py_data_sources2(train_list, test_list, module, obj, args=None):
:return: None :return: None
:rtype: None :rtype: None
""" """
def py_data2(files, load_data_module, load_data_object, load_data_args,
**kwargs):
data = DataBase()
data.type = 'py2'
data.files = files
data.load_data_module = load_data_module
data.load_data_object = load_data_object
data.load_data_args = load_data_args
data.async_load_data = True
return data
define_py_data_sources( define_py_data_sources(
train_list=train_list, train_list=train_list,
test_list=test_list, test_list=test_list,
module=module, module=module,
obj=obj, obj=obj,
args=args, args=args,
data_cls=None) data_cls=py_data2)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册