Python chainer.iterators() Examples

The following are 6 code examples of chainer.iterators(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module chainer , or try the search function .
Example #1
Source File: config_utils.py    From voxelnet_chainer with MIT License 6 votes vote down vote up
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 
Example #2
Source File: iterators.py    From espnet with Apache License 2.0 5 votes vote down vote up
def __init__(self, iterators):
        """Inits the ShufflingEnabler

        :param list[Iterator] iterators: The iterators to enable shuffling on
        """
        self.set = False
        self.iterators = iterators 
Example #3
Source File: iterators.py    From espnet with Apache License 2.0 5 votes vote down vote up
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 
Example #4
Source File: config_utils.py    From voxelnet_chainer with MIT License 5 votes vote down vote up
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 
Example #5
Source File: iterators.py    From adviser with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, iterators):
        """Inits the ShufflingEnabler

        :param list[Iterator] iterators: The iterators to enable shuffling on
        """
        self.set = False
        self.iterators = iterators 
Example #6
Source File: iterators.py    From adviser with GNU General Public License v3.0 5 votes vote down vote up
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