Exemple #1
0
 def _make_args(self, X):
     batch_size = getattr(self, 'batch_size', None)
     if batch_size is None:
         data = itertools.repeat([X])
     elif batch_size < 1:
         raise ValueError('need strictly positive batch size')
     else:
         data = iter_minibatches([X], self.batch_size, self.sample_dim)
     args = ((i, {}) for i in data)
     return args
Exemple #2
0
 def _make_args(self, X):
     batch_size = getattr(self, 'batch_size', None)
     if batch_size is None:
         data = itertools.repeat([X])
     elif batch_size < 1:
         raise ValueError('need strictly positive batch size')
     else:
         data = iter_minibatches([X], self.batch_size, self.sample_dim)
     args = ((i, {}) for i in data)
     return args
Exemple #3
0
 def _make_args(self, X, Z):
     X, Z = cast_array_to_local_type(X), cast_array_to_local_type(Z)
     batch_size = getattr(self, 'batch_size', None)
     if batch_size is None:
         data = itertools.repeat([X, Z])
     elif batch_size < 1:
         raise ValueError('need strictly positive batch size')
     else:
         data = iter_minibatches([X, Z], self.batch_size, self.sample_dim)
     args = ((i, {}) for i in data)
     return args
Exemple #4
0
    def _make_args(self, X, Z):
        batch_size = getattr(self, 'batch_size', None)
        if batch_size is None:
            X, Z = cast_array_to_local_type(X), cast_array_to_local_type(Z)
            data = itertools.repeat([X, Z])
        elif batch_size < 1:
            raise ValueError('need strictly positive batch size')
        else:
            data = iter_minibatches([X, Z], self.batch_size, self.sample_dim)
            data = ((cast_array_to_local_type(x), cast_array_to_local_type(z))
                    for x, z in data)

        args = ((i, {}) for i in data)
        return args