'Fetch another batch from the source, and shuffle it to make
negative samples.'

def _refill_queue(self):

    original = self._sourcedata.next().data
    batch_size = original[0].shape[0]
    num_inputs = len(original)
    outdata = [[o.asnumpy()] for o in original]
    outlabels = [(np.ones(batch_size) * self.positive_label)]
    for _ in range(self.sample_ratio):
        shuffled = self._shuffle_batch(original)
        for (i, d) in enumerate(shuffled):
            outdata[i].append(d)
        outlabels.append((np.ones(batch_size) * self.negative_label))
    def stacker(x):
        if (len(x[0].shape) == 1):
            return np.hstack(x)
        else:
            return np.vstack(x)
    outdata = [stacker(x) for x in outdata]
    outlabels = stacker(outlabels)
    def shuffler(x, idx):
        return np.take(x, idx, 0)
    shuf_idx = np.arange(len(outlabels))
    np.random.shuffle(shuf_idx)
    outdata = [shuffler(o, shuf_idx) for o in outdata]
    outlabels = shuffler(outlabels, shuf_idx)
    self._push_queue(outdata, outlabels)
