本文整理汇总了Python中chainer.iterators方法的典型用法代码示例。如果您正苦于以下问题:Python chainer.iterators方法的具体用法?Python chainer.iterators怎么用?Python chainer.iterators使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chainer
的用法示例。
在下文中一共展示了chainer.iterators方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_iterator
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import iterators [as 别名]
def create_iterator(train_data, test_data, config, devices, updater_name):
Iterator = getattr(chainer.iterators, config['name'])
args = parse_dict(config, 'args', {})
if 'MultiprocessParallelUpdater' in updater_name:
train_iter = [
chainer.iterators.MultiprocessIterator(i,
config['train_batchsize'],
**args)
for i in chainer.datasets.split_dataset_n_random(train_data, len(devices))]
else:
train_iter = Iterator(train_data, config['train_batchsize'], **args)
test_iter = None
if test_data is not None:
args['repeat'] = False
test_iter = Iterator(test_data, config['test_batchsize'], **args)
return train_iter, test_iter
示例2: __init__
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import iterators [as 别名]
def __init__(self, iterators):
"""Inits the ShufflingEnabler
:param list[Iterator] iterators: The iterators to enable shuffling on
"""
self.set = False
self.iterators = iterators
示例3: __call__
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import iterators [as 别名]
def __call__(self, trainer):
"""Calls the enabler on the given iterator
:param trainer: The iterator
"""
if not self.set:
for iterator in self.iterators:
iterator.start_shuffle()
self.set = True
示例4: create_iterator_test
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import iterators [as 别名]
def create_iterator_test(test_data, config):
Iterator = getattr(chainer.iterators, config['name'])
args = parse_dict(config, 'args', {})
args['repeat'] = False
args['shuffle'] = False
test_iter = Iterator(test_data, config['test_batchsize'], **args)
return test_iter